简体   繁体   中英

i can't generate scaffold?

C:\Sites\demo_app>rails generate scaffold User name:string email:string
C:/Sites/demo_app/config/application.rb:7:in `<top (required)>': undefined metho
d `groups' for Rails:Module (NoMethodError)
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `require'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

You have an error in your application.rb file.

Check for the following lines:

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

they should be replaced with

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

according to this answer by NeoRiddler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM