Tag: pg

错误运行gem install pg -v’0.15.1′

运行 gem install pg -v ‘0.15.1’ 给出错误: 构建原生扩展。 这可能需要一段时间…错误:安装pg时出错:错误:无法构建gem原生扩展。 /home/askar/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb checking for pg_config… no No pg_config… trying anyway. If 构建失败,请再次尝试使用–with -pg-config = / path / to / pg_config检查libpq-fe.h …否找不到’libpq-fe.h header * extconf.rb失败*由于某些原因无法创建Makefile,可能缺少必要的库和/或标头。 检查mkmf.log文件以获取更多详细信息。 您可能需要配置选项。 提供的配置选项: – with-opt-dir –without-opt-dir –with-opt-include –without-opt-include = $ {opt-dir} / include –with-opt-lib – without-opt-lib = $ {opt-dir} / lib –with-make-prog […]

“运行rspec时,无法在任何源中找到pg-0.12.2”

我正在使用Hartl的Rails教程构建twitter克隆应用程序。 我克隆了我的git repo( https://github.com/stewartmccoy/rails_tutorial )并将代码放到我以前在我的工作计算机上的个人计算机上。 因此,我的开发人员环境可能与我的Gemfile中指定的略有不同。 我的环境:Mac OS 10.6.8 Rails 3.2.13 ruby​​ 1.9.3p392(2013-02-22修订版39386)[x86_64-darwin10.8.0] *本地gem* 动作邮件(3.2.13,3.2.11,3.2.1) actionpack(3.2.13,3.2.11,3.2.1) activemodel(3.2.13,3.2.11,3.2.1) activerecord(3.2.13,3.2.11,3.2.1) activeresource(3.2.13,3.2.11,3.2.1) activesupport(3.2.13,3.2.11,3.2.1) 可寻址的(2.3.2) 注释(2.5.0) arel(3.0.2) bcrypt-ruby(3.0.1) bigdecimal(1.1.0) bootstrap-sass(2.1.0.0) bootstrap-will_paginate(0.0.6) 建设者(3.0.4) 捆绑器(1.3.4) 水豚(2.0.2,1.1.2) 子进程(0.3.9,0.3.6) 咖啡轨(3.2.2) 咖啡脚本(2.2.0) coffee-script-source(1.6.2,1.6.1,1.4.0) 黄瓜(1.2.1) 黄瓜栏杆(1.2.1) database_cleaner(0.7.0) 差异(1.2.1,1.1.3) erubis(2.7.0) execjs(1.4.0) factory_girl(4.1.0) factory_girl_rails(4.1.0) faker(1.0.1) ffi(1.4.0,1.3.1) 小黄瓜(2.11.5) 徒步旅行(1.2.1) i18n(0.6.1) io-console(0.3) 旅程(1.0.4) jquery-rails(2.2.1,2.1.4,2.0.2) json(1.7.7,1.7.6,1.7.5,1.5.5) libwebsocket(0.1.7.1) 邮件(2.5.3,2.4.4) 哑剧型(1.21,1.19) minitest(2.5.1) […]

接收错误PG :: UndefinedColumn:ERROR:使用Geocoder的near方法时,mymodels.distance列不存在

使用此查询时(与Railscasts第273集中相同): @locations = Location.near(params[:search], 50, :order => :distance) 或者,更简洁: @mymodels = MyModel.near(address, distance, order: :distance) 我收到错误: PG::UndefinedColumn: ERROR: column mymodels.distance does not exist 应该通过Geocoder gem将distance列添加到结果中,但它似乎不会出现在结果中(因此我得到上述错误)。

我如何设置heroku postgresql应用程序的路径?

我刚刚安装了heroku PSQL应用程序(v1.0),我无法使用gem pg“0.1.4”连接我的rails应用程序。 我已经将路径PATH =“/ Applications / Postgres.app / Contents / MacOS / bin:$ PATH”添加到我的.profile和我的.bashrc文件中,但似乎没有任何东西允许我只是通过调用“psql”来运行psql。 我成功使用“psql -h localhost”。 当我选择“psql”时,我得到: Is the server running locally and accepting connections on Unix domain socket “/var/pgsql_socket/.s.PGSQL.5432”? 我正在使用山狮。

当数据库位于不同的服务器上时安装postgres gem

我的数据库与应用程序位于不同的服务器上。 当我运行“捆绑”时,我收到以下错误: 没有pg_config ……无论如何都要尝试。 如果构建失败,请使用–with-pg-config = / path / to / pg_config重试 如果应用服务器上实际没有安装pg,如何设置pg配置路径? 我也尝试过: bundle config build.pg –without-pg_config 谢谢

在Rails <4中为Postgres JSON列设置默认值

所以我开始使用Postgres JSON数据类型,现在你可以用它做很多有趣的事情 。 在我的一个Rails应用程序中还没有Rails 4( 已经添加了对Postgres JSON的支持 ),我添加了一个这样的JSON列: create_table :foo do |t| t.column :bar, :json end 但我无法弄清楚如何为列设置默认值。 我尝试了所有变体,如{} , ‘{}’ , ‘{}’::json , ‘[]’::json等。但我在迁移运行时遇到错误或者它根本不起作用,这意味着迁移运行但是,当我创建一个新的Foo , bar是nil 。

Postgres – “pg”gem的最后一个版本0.14.0给出了错误

我已经更新了我的包含pg gem的bundler,我收到了错误 An error occured while installing pg (0.14.0), and Bundler cannot continue. Make sure that `gem install pg -v ‘0.14.0’` succeeds before bundling. 我在rubygems.org上检查了这个gem,今天(6月23日)发布了这个版本。 我不知道为什么,但版本不能正常工作并返回上面的错误。 解决方案是设置特定版本 – 在这种情况下 gem“pg”,“〜> 0.13.2” 谁有同样的问题?

Postgres rails无法识别用户

所以我的rails应用程序给了我“我们很抱歉,但出了点问题。” 当我查看日志时,我明白了 PG::Error (FATAL: role “ubuntu” does not exist ): 但是,当我这样做时(注意我相信我从来没有为角色ubuntu添加密码): sudo -u postgres createuser ubuntu Shall the new role be a superuser? (y/n) y createuser: creation of new role failed: ERROR: role “ubuntu” already exists 我在使用nginx服务器的ubuntu ec2实例上运行它。 编辑:我只是尝试卸载并重新安装postgres,并完全打破它,所以我将无法接受任何答案。

使用rvm在Mac OS Lion上安装pg gem

212-178-13-214:~ igorfedoronchuk$ gem install pg Building native extensions. This could take a while… /Users/igorfedoronchuk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:48: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 ERROR: Error installing pg: ERROR: Failed to build gem native extension. /Users/igorfedoronchuk/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb checking for pg_config… yes Using config values from /usr/bin/pg_config checking for libpq-fe.h… *** extconf.rb failed *** Could not […]

Rails / Ruby / Postgres – LoadError无法加载此类文件 – pg_ext

我正在尝试使用下面的rails控制器调用Ruby脚本(连接到postgres数据库),但是它似乎在加载其中一个PG gem文件时遇到问题。 我已将require语句设置为require’pg’并尝试了绝对路径(需要/usr/local/rvm/gems/ruby-1.9.3-p194@railsTest/gems/pg-0.14.0/lib/pg/ )。 文件’pg_ext’实际上存在于目录中。 另外,我可以独立运行ruby脚本而没有任何问题(dbrubyscript.rb),但是当rails被添加到这个等式中时,它cannot load such file — pg_ext错误。 这里的任何方向都会非常感激,因为我无法找到解决此问题的在线任何内容 Rails控制器: class TestdlController ‘text/csv’, :disposition => ‘inline’ flash[:notice] = “Reports are being processed…” end end .rb文件(dbrubyscript.rb)具有以下内容: require ‘rubygems’ require ‘pg’ connects to (production) database @conn = PGconn.connect(“zzzzz.test.prod”, 5432,””,””,”yyyyy_prod” ,”postgres”, “xxxxxx”) ….. 跟踪错误: TestdlController中的LoadError#runmyscript 无法加载此类文件 – pg_ext Rails.root:/ usr / local / rvm / […]