我不能生成脚手架?

时间:2012-02-17 20:46:34

标签: ruby-on-rails

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>'

1 个答案:

答案 0 :(得分:0)

您的application.rb文件中有错误。

检查以下行:

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

应该用

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

根据NeoRiddler的this answer