Rails 3.2 Mountable Local Local Application Locator

I see a scenario where my locale parameter is duplicated when I enter the mounted application. My application looks like this:

#routes.rb

resources :blogs

scope "(:locale)" do
  mount Auth::Engine => '/auth'
end

If I'm on a blog page and look at the auth link, it looks like /en-us/auth/signoutthat works well, but as soon as I load on any page displayed by the mounted application, for example a profile page /en-us/auth/myprofile', the exit link now looks like/en-us/auth/signout?locale=en-us

I don’t want the querystring to get cluttered, which forces the application to set the locale parameter correctly and then duplicate it in querystring?

+3
source share
2 answers

My bet is that your application controller has something like:

def set_locale
  # code here
end

def default_url_options
  # code here
end

, set_locale .

: , , .

self.controller_path().split("/").first == engine_name

+1

. url ( default_url_options self.default_url_options=).

, Rails.application.routes.default_url_options =.

+1

All Articles