23
How can I go about making my routes recognise an optional prefix parameter as follows:
/*lang/controller/id
In that the lang part is optional, and has a default value if it's not specified in the URL:
/en/posts/1 => lang = en
/fr/posts/1 => lang = fr
/posts/1 => lang = en
EDIT
Ideally, I'm looking to do this across many controllers and actions by mapping a namespace:
map.namespace "*lang" do |lang|
lang.resources :posts
lang.resources :stories
end