我在 routes.rb 中添加:
match ':controller(/:action(/:id(.:format)))'
执行
rails g controller 命令报错
ubuntu@ubuntu:~/project/demo$ rails g controller www
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:191:in normalize_conditions!': You should not use thematchmethod in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to both GET and POST, addvia: [:get, :post]option.
If you want to expose your action to GET, usegetin the router:
Instead of: match "controller#action"
Do: get "controller#action"
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:67:ininitialize'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1443:in new'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1443:inadd_route'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1422:in decomposed_match'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1403:inblock in match'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1394:in each'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1394:inmatch'
from /home/ubuntu/project/demo/config/routes.rb:62:in block in <top (required)>'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:ininstance_exec'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in eval_block'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:319:indraw'
from /home/ubuntu/project/demo/config/routes.rb:1:in <top (required)>'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:inload'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in block in load'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:inload_dependency'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in load'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:inblock in load_paths'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in each'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:inload_paths'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:16:in reload!'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:26:inblock in updater'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in call'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:inexecute'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:27:in updater'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:6:inexecute_if_updated'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application/finisher.rb:69:in block in <module:Finisher>'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/initializable.rb:30:ininstance_exec'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/initializable.rb:30:in run'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/initializable.rb:55:inblock in run_initializers'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:150:in block in tsort_each'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:183:inblock (2 levels) in each_strongly_connected_component'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:219:in each_strongly_connected_component_from'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:182:inblock in each_strongly_connected_component'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:180:in each'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:180:ineach_strongly_connected_component'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/tsort.rb:148:in tsort_each'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/initializable.rb:54:inrun_initializers'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application.rb:215:in initialize!'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from /home/ubuntu/project/demo/config/environment.rb:5:in <top (required)>'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application.rb:189:inrequire'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/application.rb:189:in require_environment!'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.3/lib/rails/commands.rb:44:in'
from bin/rails:4:in require'
from bin/rails:4:in