This project is archived and is in readonly mode.
Routing :defaults option is not passed through to params
Reported by Jeroen van Dijk | March 8th, 2010 @ 05:24 PM | in 3.0.2
The :defaults option in routing is not passed through to the controller params.
eg.
match 'photos/:id' => 'photos#show', :defaults => { :format => 'jpg' }
does not pass :format through to path_parameters, which is accessible via params in the controller.
Originally reported by Henrique in ticket 119 in Rails Guides.
Comments and changes to this ticket
-
José Valim March 8th, 2010 @ 10:54 PM
- Milestone cleared.
- Assigned user set to josh
-
josh March 15th, 2010 @ 02:48 PM
- State changed from new to wontfix
:defaults was sort of deprecated even in the old dsl.
match 'photos/:id' => 'photos#show', :format => 'jpg'
should be the preferred dsl.
-
carl March 22nd, 2010 @ 09:08 PM
Has the new DSL which Joshua Peek mentioned been added to the current beta of rails3? I can't seem to get it to work.
-
Henrique March 22nd, 2010 @ 09:26 PM
Didn't get it to work either, that was the reason for the ticket. There is no way right now to pass parameters through the routes.
@carl do you tested against Rails edge?
-
Jeroen van Dijk April 7th, 2010 @ 08:14 PM
I haven't had the time to see if the suggested functionality works. I hope to do that soon, but this post of Yehuda describes the deprecated dsl (with :defaults), see http://www.railsdispatch.com/posts/rails-3-makes-life-better and search for ':defaults'
-
José Valim April 7th, 2010 @ 08:26 PM
It seems that support for it was added later. Please do investigate. :)
-
Jeroen van Dijk April 24th, 2010 @ 09:32 AM
I have reran the tests against master and everything works. Both with :defaults and without so Yehuda's post was not incorrect after all. After a 'git blame' I found #4265 which resolves this issue, here is the specific commit: http://github.com/rails/rails/commit/3d746fcdb584767c476408f395320e...
In summary, this ticket can be closed.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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>