Sunday, 15 April 2012

ruby on rails - How to put default_url_option for specific path only -



ruby on rails - How to put default_url_option for specific path only -

i using defaul_url_option putting lang params in url e.g. home/?lang=en, of ajax function not working because of parameter lang added url request, how specify in specific path or routes

actually should not touch lang param in of routes, unless want alter language.

your app controller should have:

def default_url_options(options={}) logger.debug "default_url_options passed options: #{options.inspect}\n" { lang: i18n.locale } end

and routes.rb:

scope "/(:lang)", :lang => /de|en/ # resources definitions end

now, in of route not need provide lang param (unless want switch language), generated out of box.

ruby-on-rails

No comments:

Post a Comment