I’m developing some custom routes for an application and am creating the
aliased url_for commands that I like so much. However, one of the things
like to do is read a string from the session (or possibly even pull out
object to get to the string) and use that in the URL generating by the
– without having to pass the string into the url_for alias every time.
After attempting to access the session method and session class variable
routes.rb to ill effect (you just can’t) and also trying to run a
in routes.rb (which also doesn’t seem to work quite right) – I can’t
figure out what information is available to the app at that stage.
through the API docs and Routing how-tos, I’ve found nothing that sheds
light at this aspect of routes.rb.
So, has anyone had any success with this? Is it possible to override
aliased url_for method to automatically grab the “label” from the
and put into the default arguments for the url_for alias? If so, where
I put that-- in the application helper? (doesn’t quite seem right)…
Did this make sense or do I need to restate my problem?
I want a route – :label/:controller/:action/:id – where :label comes
automatically from the session.
Thank you for any help in this direction.
D. Taylor S.,