This project is archived and is in readonly mode.

#2117 ✓invalid
Zac Zheng

routes with namespace not generating correctly

Reported by Zac Zheng | March 3rd, 2009 @ 02:15 PM | in 2.x

my routes.rb:

map.namespace :admin do |admin|

admin.resources :api_keys, :member => { :accept => :put, :deny => :put }

end

using path: accept_admin_api_key_url(api_key.id)

generates incorrect URL: http://localhost:3000/admin/api_...

The above URL gives 'no page found' error.

This URL seems to be correct. http://localhost:3000/admin/api_...

Is this a bug?

Comments and changes to this ticket

  • CancelProfileIsBroken

    CancelProfileIsBroken March 11th, 2009 @ 09:56 PM

    • State changed from “new” to “invalid”

    accept_admin_api_key_url(api_key.id) should generate http://localhost:3000/admin/api_..., as you say it does. So the route generation here is correct.

    The question is what you're doing to get the 404? If you're just clicking on a link, that won't be handled by this route because you specified the PUT verb.

    Your second URL gets handled by the magic :controller/:action/:id route, which doesn't care what verb you specify.

    If you have some other method that you're trying to go to this URL with a reproducible recognition bug, please submit a new 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>

Tags

Pages