I made my routes recognize optional path prefixes, but now I want route generation to remember them without me specifying them each time. I'm using the solution presented here:
http://stackoverflow.com/questions/212425/creating-routes-with-an-optional-path-prefix
Here are some examples:
Let's say I'm here: { path => "/", :contoller => 'welcome', :action => 'index', :locale => 'en' }
then route generation works like this:
events_path #=> "/en/events"
event_path(1) #=> "/en/events/1"
This is exactly what I want, and everything's great.
Now let's consider I'm here: { path => "/fr", :contoller => 'welcome', :action => 'index', :locale => 'fr' }
then route generation works like this:
events_path #=> "/en/events"
events_path(1) #=> "/en/events/1"
This is not helping me at all. What it would be natural to have is events_path
to remember params[:locale]
and generate "/fr/events"
. Is there any way I can achieve this?