我在 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 the
matchmethod in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to both GET and POST, add
via: [:get, :post]option.
If you want to expose your action to GET, use
getin 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:in
initialize'
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:in
add_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:in
block 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:in
match'
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:in
instance_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:in
draw'
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:in
load'
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:in
load_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:in
block 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:in
load_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:in
block 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:in
execute'
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:in
execute_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:in
instance_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:in
block 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:in
block (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:in
block 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:in
each_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:in
run_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:in
method_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:in
require'
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