jjzjj

ruby-on-rails - pg_search 使用 associated_against 给出错误 "column [model_name].[associated_column_name] does not exist"

我正在尝试使用pg_search来搜索关联模型。当我运行搜索时,出现错误“PG::Error:ERROR:columnplans.namedoesnotexist”。我正在“计划”模型中运行搜索,并尝试针对“地点”与列“名称”的关联进行搜索。连接这些的has_many:through模型是多态的。不知何故,sql查询将两者结合起来并抛出错误。我已经运行了associated_against迁移(railsgpg_search:migration:associated_against),搜索了文档,并寻找其他有错误的人,但一无所获,一定是我只是忽略了一些东西。如果我只是删除plan.rb

ruby-on-rails - rake 数据库 :migrate not working on my postgres db

好的,所以我有一个Rails应用程序,我试图在postgres数据库上运行迁移,我通常使用mysql,一切都很好,但是当我运行命令时,我得到了这个rakedb:migrate(in/Users/tamer/Sites/my_app)/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487:[BUG]Segmentationfaultruby1.9.2p290(2011-07-09

ruby-on-rails - Rails 国际化 : %{record} is not being translated

我的rails.pt-BR.yml上有这个:br:errors:format:!'%{attribute}%{message}'messages:restrict_dependent_destroy:one:"Nãoépossívelexcluiroregistropoisexisteum%{record}dependente"many:"Nãoépossívelexcluiroregistropoisexistem%{record}dependentes"在我的模型中,我有这个:has_many:entities,dependent::restrict_with_error每当res

ruby - 如何在 Chef Recipe 中使用 not_if

我是Chef的新手,所以我对条件not_if在执行资源中的工作方式有些困惑。我知道如果命令返回0或true,它会告诉Chef不要执行命令;但是,在我的代码中,它显然仍在运行命令。下面的代码应该创建一个用户(及其密码)和一个数据库;然而,如果用户和数据库已经存在,它不应该做任何事情。用户、数据库和密码在属性中定义。以下是我的代码:execute"create-user"docode=Chef给我以下错误:在资源“execute[create-user]”上执行操作run时出错...[2013-01-25T12:24:51-08:00]致命:Mixlib::ShellOut::ShellC

ruby-on-rails - Rails 3.2 ActiveAdmin 'Collection is not a paginated scope.' 错误

我正在使用Rails3.2和ActiveAdmin0.4.4开发应用程序。我有一个名为Teaser的模型(/app/models/teaser.rb):classTeasertruemount_uploader:img,TeaserUploaderend然后我向其中添加了ActiveAdmin(/app/admin/teaser.rb):#encoding:UTF-8ActiveAdmin.registerTeaserdoformdo|f|f.inputs"Teaser"dof.input:name,:label=>'Текст'f.input:url,:label=>'Ссылка'

ruby-on-rails - rails : why is calling to_a on a string not valid in a rake task?

我正在尝试解密一组用于数据库迁移的密码。我有一些旧的Rails代码(实际上是一个Runner脚本)可以很好地解密它们。但是将相同的代码放入Rake任务会导致任务失败,并显示...未定义的方法`to_a'for"secretkey":String...为什么在字符串上调用to_a在Rake任务中无效,但在Runner脚本中却完全有效?require'openssl'KEY='secretkey'namespace:importdotask:users=>:environmentdodefdecrypt_password(pw)cipher=OpenSSL::Cipher::Cipher.

ruby-on-rails - 从设计 "User does not respond to ' 设计方法中获取错误“运行 "rails generate devise:install"时

当运行“railsgeneratedevise:install”时,我从设计中收到错误“用户不响应‘设计’方法”。想法重新如何解决?事实上,当我尝试运行“railsgeneratedevise:install”时,我也注意到了这个错误。注意事项:Gregs-MacBook-Pro:testappgreg$railsgeneratedevise:install/Library/Ruby/Gems/1.8/gems/devise-2.0.1/lib/devise/rails/routes.rb:406:in`raise_no_devise_method_error!':Userdoesno

ruby-on-rails - Rails4 : Why resque worker is not picking up jobs

我在我的Rails4应用程序中使用resque和resque_scheduler。我的应用程序正在为resque提供一些工作,但工作人员没有在处理这些工作。reque-web显示没有失败。我已经通过运行开始resqueworkerQUEUE=kqueuerakeenvironmentresque:work我的rails控制台2.0.0p353:006>Resque.info=>{:pending=>0,:processed=>0,:queues=>0,:workers=>1,:working=>0,:failed=>0,:servers=>["redis://localhost:637

ruby-on-rails - 错误 : Command 'test' not recognized

我在Rails服务器中使用c9.io进行开发。我执行railstest并且它可以正常工作。第二天,我执行相同的命令,但出现错误:无法识别命令“测试”我没有做任何更改。我怎样才能恢复这个命令?注意:rake测试完美运行,但ruby​​页面http://edgeguides.rubyonrails.org/testing.html和ruby​​onrails教程,MichaelHartlhttps://www.railstutorial.org/book/static_pages谈论railstest命令,它对我有用2天。这是我的gem文件source'https://rubygems.o

ruby - 使用自定义 gem 源的 bundler 出现 "Could not find gem …"错误

在我的Gemfile中,我需要一个来自自定义源的gem,其中包含以下行:gem'very-secret-gem',source:'https://foo.example.com/'bundleinstall完成正常:$bundleinstallFetchingsourceindexfromhttps://foo.example.com/Fetchingsourceindexfromhttps://foo.example.com/Fetchinggemmetadatafromhttps://rubygems.org/........…Resolvingdependencies...…In