I have been wrestling with rails 3 routes for hours trying to accomplish
the following:
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.
Seems like it would be a lot easier to just have the logic in the controller.
Right now you have the logic in the routes, then you’ll also need logic in the controller to check whether params[:id] or params[:site_photo_id] exists.
If you have just one route and move the logic to the controller, you’ll accomplish what you’re looking for, and avoid repeating logic in routes and controller.