Rails:Module 的未定义方法“groups" [英] undefined method `groups' for Rails:Module

查看:42
本文介绍了Rails:Module 的未定义方法“groups"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像往常一样,我一直是个白痴,不知何故我的 mac 上的导轨坏了.我认为这一切都始于它说 rake 的版本不够新,所以我深入研究了不同 gem 等和不同版本 rails 的巨大道路,我最终从 github 获得了 rails,但它用最新的替换了它版本.

As usual I've been an idiot and broken rails on my mac somehow. I think it all started when it said the version of rake wasn't recent enough so I delved down a huge road of different gems etc. and different versions of rails, I ended up getting rails from github but it replaces it with the most recent version.

现在我担心我的所有配置文件都不正确,但是当我尝试 'rake rails:update' 时,我收到以下带有跟踪的错误:

Now I fear all of my configuration files are incorrect, but when I try to 'rake rails:update' I get the following error with a trace:

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

今晚我已经受够了,我已经访问了 100 万条路由(这一切都始于尝试让身份验证添加工作).

I've pretty much had enough tonight, I've been down a million routes (it all started with trying to get an authentication add on to work).

我想要做的就是将配置文件重置为最初用于 rails 3.0.9 的配置文件,我的 gem 文件来自:

All i want to do is reset the config files to what they were originally for rails 3.0.9, my gem file went from:

gem 'rails', '3.0.9'

gem 'rails', '3.0.9'

gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'rails', :git => 'git://github.com/rails/rails.git'

回到

gem 'rails', '3.0.9'

gem 'rails', '3.0.9'

...我是个白痴...但是一个头疼得厉害的白痴.

...I'm an idiot...but an idiot with a huge headache.

推荐答案

我的错误:我有同样的错误,你可以在这里看到:

My error: I have the same error, as you can see here:

$ 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

config/application.rb 文件中,我有以下几行:

In config/application.rb file, I have these lines:

if defined?(Bundler)
  Bundler.require(*Rails.groups(:assets => %w(development test)))
end

然后我检查了另一个 Rails 3 应用程序,在这个应用程序中我再次检查了这个文件,它包含以下几行:

Then I checked another Rails 3 app, in this app I checked again this file and it contains these lines:

Bundler.require(:default, Rails.env) if defined?(Bundler)

所以我替换了这条线,然后我开始工作了.

So I sustitute this line and I works.

我也希望成为您的解决方案.

I hope to be your solution too.

这篇关于Rails:Module 的未定义方法“groups"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆