草庐IT

pg_search_scope

全部标签

ruby-on-rails - PostgreSQL gem pg 无法安装

我的数据库是PostgreSQL。我在CENTOS上...。在安装pggem时,我收到以下错误。我也重新安装以清除我的YAML问题,但没有用,但这只是一个警告。我的主要问题是pggem的安装:[root@vdimc04~]#geminstallpg/usr/local/lib/ruby/1.9.1/yaml.rb:56:in`':Itseemsyourrubyinstallationismissingpsych(forYAMLoutput).Toeliminatethiswarning,pleaseinstalllibyamlandreinstallyourruby.Buildingn

ruby-on-rails - rails : Testing named scopes with RSpec

我是测试Rails网络应用程序和RSpec的新手。我使用遗留代码并需要添加测试。那么使用RSpec测试查找器和命名范围的最佳方法是什么?我在Google中找到了一些方法,但它们并不理想。例如:http://paulsturgess.co.uk/articles/show/93-using-rspec-to-test-a-named_scope-in-ruby-on-railsit"excludesusersthatarenotactive"do@user=Factory(:user,:active=>false)User.active.should_notinclude(@user)e

ruby - gem install pg 不适用于 OSX Lion

这个问题围绕SO有很多变化,但似乎没有一个能解决我的问题。我正在运行OSXLion(10.7.3)。安装了最新的XCode。我使用来自postgresapp.com的Postgres.app包安装了Postgres。但是当我尝试安装pggem时,我失败了:$geminstallpg----with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_configBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingpg:ERROR:Fail

ruby-on-rails - PG::错误:SELECT DISTINCT,ORDER BY 表达式必须出现在选择列表中

ActionView::Template::Error(PG::Error:ERROR:forSELECTDISTINCT,ORDERBYexpressionsmustappearinselectlist我正在创建一个事件网站,我正在尝试按事件的开始时间对呈现的rsvps进行排序。有很多RSVPS,所以我将它们分组为不同的,但在过去的几天里,我在排序结果时遇到了很多困难,而没有在PG上弹出这个错误。我已经查看了之前关于该主题的一些问题,但仍然很迷茫。我怎样才能让它工作?非常感谢!@rsvps=Rsvp.where(:voter_id=>current_user.following.co

ruby-on-rails - Gem::LoadError: 无法激活 pg (~> 0.18),已激活 pg-1.0.0

这个问题在这里已经有了答案:RailsapplicationusingPostgresadaptercan'tactivatepg(1个回答)关闭4年前。我一直在做Rails教程发现here并且已经成功到必须使用$railsdb:migrate来迁移Comments迁移。在此之前,我已经能够毫无问题地生成文章模型并迁移文章创建迁移。在这两次迁移之间,我的Gemfile中没有任何变化,所以我不确定Bundler有什么问题。这是错误,后面是完整的命令行输出,以及我的Gemfile和schema.rb:Gem::LoadError:can'tactivatepg(~>0.18),alread

ruby-on-rails - 错误信息: Make sure that `gem install pg -v ' 0. 18. 1'` 绑定(bind)成功

我对ruby有疑问。我尝试了很多,但对我没有任何用处。当我想启动railsserver时,我得到这个错误信息:Anerroroccurredwhileinstallingpg(0.18.1),andBundlercannotcontinue.Makesurethat"geminstallpg-v'0.18.1"succeedsbeforebundling.这是我已经尝试过的:sudoinstallgembundleinstallbundleinstall--pathvendor/cachegeminstallpg-v'0.18.1'当我尝试geminstallpg-v'0.18.1'时

ruby-on-rails - Rails : named_scope, lambda 和 block

我认为下面两个是等价的:named_scope:admin,lambda{|company_id|{:conditions=>['company_id=?',company_id]}}named_scope:admin,lambdado|company_id|{:conditions=>['company_id=?',company_id]}end但Ruby正在提示:ArgumentError:triedtocreateProcobjectwithoutablock有什么想法吗? 最佳答案 这是一个解析器问题。试试这个named_s

ruby-on-rails - PG::错误:错误:新编码(UTF8)不兼容

我已经从源代码安装了postgresql-9.2.4,现在当我执行时在railsapp中:rakedb:create命令我得到:$bin/rakedb:createRAILS_ENV="test"PG::Error:ERROR:newencoding(UTF8)isincompatiblewiththeencodingofthetemplatedatabase(SQL_ASCII)HINT:Usethesameencodingasinthetemplatedatabase,orusetemplate0astemplate.:CREATEDATABASE"verticals_test"E

ruby-on-rails - 无法安装 pg gem

我尝试使用geminstallpg但它似乎不起作用。geminstallpg给出这个错误TemporarilyenhancingPATHtoincludeDevKit...Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingpg:ERROR:Failedtobuildgemnativeextension.C:/Ruby/bin/ruby.exeextconf.rbcheckingforpg_config...noNopg_config...tryinganyway.Ifbuildingfails,ple

ruby-on-rails - PG::ConnectionBad - 无法连接到服务器:连接被拒绝

每次我运行rails4.0服务器时,我都会得到这个输出。StartedGET"/"for127.0.0.1at2013-11-0623:56:36-0500PG::ConnectionBad-couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(::1)andacceptingTCP/IPconnectionsonport5432?couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(12