This project is archived and is in readonly mode.

#4718 ✓duplicate
wildchild

Some url helpers are broken

Reported by wildchild | May 28th, 2010 @ 03:58 PM

If :to option is a proc then *_path helpers will append controller and action options. Assuming the following routes are defined:

get "/foo", :to => proc { |env| [200, {"Content-Type" => "text/plain"}, ["Hello world"]] }, :as => :foo
get "/bar", :to => redirect("/"), :as => :bar

The output of (foo|bar)_path helpers:

/foo?action=edit&controller=home
/bar?action=edit&controller=home

The test in routing_test.rb is available:

Line 33: match 'account/logout' => redirect("/logout"), :as => :logout_redirect
...
Line 310: assert_equal '/account/logout', logout_redirect_path

Pretty confused.

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>

Pages