Displaying 1 result from an estimated 1 matches for "site_photo_id".
2011 Oct 05
3
Rails 3 routes with same name, different param name based on constraint
...ing:
I want to use the *same url helper* (photo_url) in my views but have a
different route match made depending on the format of the parameter I
pass. Seems simple enough, right??
If the parameter looks like nn.nn.nnnnnn.whatever, I want the param
passed to "photos#show" to be called :site_photo_id. If the parameter
looks like an integer, I want the param passed to be :id.
I have tried the following:
match "/photos/:site_photo_id", :to => "photos#show", :as => "photo",
:constraints => {:site_photo_id => /\d{2}\.\d{2}\..*/}
match "/photos/:id&...