rails/rails — Issue #3280: Shorthand route nested in scope produces missing controller error
Author: ncri
Created: 2011-10-10 14:35:37+00:00
State: open

This throws a missing :controller exception:

scope "(:locale)" do
get "contoller/action"
end

Stack trace:

```
missing :controller
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:177:in `default_controller_and_action'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:74:in `normalize_options!'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:57:in `initialize'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:383:in `new'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:383:in `match'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:1290:in `match'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:1477:in `match'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:513:in `map_method'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:475:in `get'
/Users/nico/Rails/yousty/config/routes.rb:4:in `block (2 levels) in '
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:630:in `scope'
/Users/nico/Rails/yousty/config/routes.rb:3:in `block in '
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:257:in `instance_exec'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:257:in `eval_block'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:234:in `draw'
/Users/nico/Rails/yousty/config/routes.rb:1:in `'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `block in load'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `each'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `load_paths'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:13:in `reload!'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/file_update_checker.rb:32:in `call'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/finisher.rb:63:in `block (2 levels) in '
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/finisher.rb:64:in `call'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/finisher.rb:64:in `block in '
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/nico/Rails/yousty/config/environment.rb:6:in `'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:189:in `block (2 levels) in initialize_tasks'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/nico/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/nico/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/bin/rake:32:in `'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/nico/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `

'
```

This works:

scope "(:locale)" do
match "contoller/action" => "contoller#action", :via => :get
end