2012-04-22 96 views
0

我嘗試使用this tutorial,但腳手架生成代碼有一些問題。不能生成腳手架

application.rb中

this topic
Bundler.require(:default, Rails.env) if defined?(Bundler) 
#if defined?(Bundler) 
    # If you precompile assets before deploying to production, use this line 
    # Bundler.require(*Rails.groups(:assets => %w(development test))) 
    # If you want your assets lazily compiled in production, use this line 
    # Bundler.require(:default, :assets, Rails.env) 
#end 

採取的解決方案,但並不好這個問題。

登錄:

C:\Users\Evgeny\Rails_projects\demo_app>rails generate scaffold User name:string 
email:string 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/ra 
iltie/configuration.rb:77:in `method_missing': undefined method `assets' for #<R 
ails::Application::Configuration:0x3a03248> (NoMethodError) 
     from C:/Users/Evgeny/Rails_projects/demo_app/config/application.rb:55:in 
`<class:Application>' 
     from C:/Users/Evgeny/Rails_projects/demo_app/config/application.rb:14:in 
`<module:DemoApp>' 
     from C:/Users/Evgeny/Rails_projects/demo_app/config/application.rb:13:in 
`<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.9 
/lib/rails/commands.rb:15:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/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>' 

配置應用程序:

source 'http://rubygems.org' 

gem 'rails', '3.0.9' 
gem 'sqlite3', '1.3.3' 

回答

0

Rails資產管道在Rails 3.1及更高版本之前不可用。我在C:/Users/Evgeny/Rails_projects/demo_app/config/application.rb的第55行猜測,你有一個config.assets行導致了這個問題。刪除該行或升級到Rails 3.1或3.2