Generating urls dynamically in Ruby on Rails that may or maynot contain / in between
I am making a RoR site that is delivered in several languages, and want to change a part of the url by its language.
ex.
http://xxxx/en/index.html
http://xxxx/fr/index.html
I know I can do this via the route.rb
map.locale ':lang/index.html'
and designate the language when calli开发者_StackOverflowng this in view. However, there is an exception to this, when in the default language of the site, I want the url to be without the language identifier,
http://xxxx/index.html
as so.
Currently I cannot find a way to git rid of the / after the language identifier,
http://xxxx//index.html
is there a better way to do this?
It's not (yet) possible.
But you'll find some solution on this stackoverflow question.
精彩评论