Undefined `groups' method for Rails: module

As usual, I was somehow an idiot and broken rails on my mac. I think it all started when he said that the rake version was not recent enough, so I delved into a huge road of various gems, etc. And different versions of rails, and in the end I got rails from github, but it replaces it with the latest version.

Now I'm afraid that all my configuration files are incorrect, but when I try "rake rails: update", I get the following trace error:

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 

Today I had quite a lot, I had a million routes (it all started with an attempt to add authentication to the work).

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

gem 'rails', '3.0.9'

to

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

back to

gem 'rails', '3.0.9'

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

+6
source share
4 answers

My mistake: 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 

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

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

Then I checked another Rails 3 application, in this application I checked this file again and it contains the following lines:

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

So, I support this line and I am working.

Hope you will be your decision too.

+4
source

The problem is that your application was generated with rails version 3.1 or higher. He is trying to call the "groups" method, which is not there. If you have not gone too far, just start from scratch. Otherwise, create a dummy project and compare the config / application.rb files. Make them appropriate.

+3
source

Read this article: http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/

or

TL; DR bundle install --path vendor , then bundle --binstub , then bin/rake whatever

oh and don't forget .rvmrc in the application directory

+1
source

I think you have already found the answer to your questions? however, adding the source code below at the top of config / application.rb may help you.

 require 'rails/all' 
0
source

Source: https://habr.com/ru/post/893531/


All Articles