Hello reader,
with the following routes I try to achive the goal, that I can present static resources like terms of use, imprint and so on in different languages using different urls.
I defined two example routes for my imprint like that:
map.imprint ':lang/impressum', :controller => "statics", :action => "imprint", :requirements => {:lang => /de/}
map.imprint ':lang/imprint', :controller => "statics", :action => "imprint", :requirements => {:lang => /en/}
Now in my view I try to use the path/url helper like that:
<%= link_to(t(statics.imprint.linkname), imprint_url(:lang => session[language])) %>
where there session[:language] is "de" or "en".
Thats results in a working link for the de route. But the english one fails. If I change the order of the routes, it's vice versa, and the english one works, while the german one fails.
The error always reads like that:
imprint_url failed to generate from {:controller=>"statics", :lang=>"de", :action=>"imprint"}, expected: {:controller=>"statics", :action=>"imprint"}, diff: {:lang=>"de"}
Can anyone help out with this?
Thanks. Jason