像往常一样,我以某种方式在我的Mac上一直是个白痴和破坏的铁轨.我认为这一切都是在它说rake的版本不够新的时候开始的,所以我深入研究了不同宝石的巨大道路等等和不同版本的rails,我最终从github获得了rails,但它取代了最近的版.
现在我担心我的所有配置文件都不正确,但是当我尝试'rake rails:update'时,我得到以下错误跟踪:
rake aborted!
undefined method `groups' for Rails:Module
/Users/jamielawrence/Documents/Websites/JaphexPortfolio/config/application.rb:8
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
/Users/jamielawrence/Documents/Websites/JaphexPortfolio/Rakefile:4
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:78:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:61:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Run Code Online (Sandbox Code Playgroud)
今晚我已经足够了,我已经减少了一百万条路线(这一切都始于试图获得认证加入工作).
我想要做的就是将配置文件重置为原来的rails 3.0.9,我的gem文件来自:
宝石'轨道','3.0.9'
至
gem'rails',: git =>'git://github.com/rails/rails.git'
回到
宝石'轨道','3.0.9'
......我是个白痴......但是一个头疼的白痴.
我的错误:我有同样的错误,你可以在这里看到:
$ rails c production
config/application.rb:7: undefined method `groups' for Rails:Module (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21
from script/rails:6:in `require'
from script/rails:6
Run Code Online (Sandbox Code Playgroud)
在config/application.rb
文件中,我有这些行:
if defined?(Bundler)
Bundler.require(*Rails.groups(:assets => %w(development test)))
end
Run Code Online (Sandbox Code Playgroud)
然后我检查了另一个Rails 3应用程序,在这个应用程序中我再次检查了这个文件,它包含以下行:
Bundler.require(:default, Rails.env) if defined?(Bundler)
Run Code Online (Sandbox Code Playgroud)
所以我替换这一行并且我工作.
我希望也成为你的解决方案.
阅读这篇文章:http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/
或者
TLDR bundle install --path vendor
然后bundle --binstub
然后bin/rake whatever
哦,不要忘记应用程序目录中的 .rvmrc