无法生成控制器(它不会出现在/ app / controllers /中)rails generate controller StaticPages
输出:
azureuser@host:~/railstutorial_apps/demo$ rails generate controller StaticPages --no-test-framework
/home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load': /home/azureuser/railstutorial_
/home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load': /home/azureuser/railst[0/1427]
apps/demo/config/initializers/session_store.rb:1: syntax error, unexpected keyword_when, expecting end-of-input
ure to restart your server when you modify this file.
^ (SyntaxError)
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/engine.rb:651:in `load_config_initializer'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/engine.rb:615:in `each'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
from /home/azureuser/railstutorial_apps/demo/config/environment.rb:5:in `<top (required)>'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:92:in `require'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:92:in `preload'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /home/azureuser/.rvm/gems/ruby-2.0.0-p643@railstutorial_gemset/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/azureuser/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
azureuser@host:~/railstutorial_apps/demo$
答案 0 :(得分:1)
根据我的评论,{{1}}中存在错误。修复此错误后,您将能够生成控制器。