This project is archived and is in readonly mode.

#6517 ✓resolved
lakshmanan

Named Routes in routes.rb shows syntax error in actionpack

Reported by lakshmanan | March 4th, 2011 @ 07:11 AM | in 3.x

I have a named route in my routes.rb file like

  match "/orders/summary_sales/:event_id.:format" => "orders#summary_sales", :as => "formatted_summary_sales"

If i leave a space after "formatted_summary_sales" in :as option like below

  match "/orders/summary_sales/:event_id.:format" => "orders#summary_sales", :as => "formatted_summary_sales "

and if i run "rake routes", the following error occurs.

Invoke routes (first_time) Invoke environment (first_time) ** Execute environment rake aborted!
/Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:161: syntax error, unexpected '(', expecting ';' or '\n' ...r_formatted_summary_sales url(options = nil) ... ... ^ /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:161: syntax error, unexpected ')', expecting $end ...mmary_sales url(options = nil) ... ... ^ /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:160:in module_eval' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:160:indefine_hash_access' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:151:in block in define_named_route_methods' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:149:ineach' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:149:in define_named_route_methods' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:100:inadd' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:300:in add_route' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:273:inmatch' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1173:in match' /Users/lakshmanan/.rvm/gems/ruby-1.9.2-p136@da3/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1358:inmatch' /Users/lakshmanan/projects/da/config/routes.rb:92:in `block in '

Strange. But if I i dont give that space, I get the proper rake routes ouput.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages