I’m using set_locale for language handling. My client requested to have locale included in the path instead of parameters. So instead of:
Furthermore, for the default locale, the path SHOULD NOT include locale, but instead, it should be assigned via cookies. Assuming that default locale is
en, instead of:
With a bit of modification in set_locale I was able to set the root path for default locale without including it in the path. There is however a problem here. I need to include
@locale in every path helper (routes are scoped in
/:locale) across the entire app. For default locale, I don’t want to include it in the path since it’s one of the client requests.
So the question is - Is there any way to pass default params to path generators globally? In Rails, I’m able to achieve that with the
default_url_options method in Controller. Such a default URL option in my case depends on
@conn assigns which is probably problematic.