title: before_filter set_locale except controller
body: <p>My <code>routes.rb</code></p>
  
  <pre><code>MyApp::Application.routes.draw do
   scope '(:locale)' do
    #all resources here
   end
   namespace :blog do
    resources :posts, :only =&gt; [:index, :show]
   end
  end
  </code></pre>
  
  <p>My <code>application_controller.rb</code></p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
   #
   #
   before_filter :set_locale
  
   private
  
   def default_url_options(options = {})
     {locale: I18n.locale}
   end
  
   def set_locale
     #code for detect locale here
   end
   #
   #
  end
  </code></pre>
  
  <p>All the resources inside <code>scope '(:locale)'</code> is working fine. </p>
  
  <p>However <strong>I don't want use locale with <code>namespace :blog</code></strong> and when I try click on blog links I can see this url <code>http://localhost:3000/blog/posts?locale=en</code></p>
  
  <p><strong>How can I remove locale of <code>namespace :blog...</code> and <code>blog resource</code>?. I want get a url something like <code>http://localhost:3000/blog/posts</code></strong> I want to remove the <code>?locale=en</code></p>
  
  <p><strong>Thanks!</strong></p>