title: Rails4 route with scope and namespace
body: <p>quite new to Ruby and Rails, so it's probably a dumb question ;)</p>
  
  <p>I try to get a "i18n" route working with an "admin" namespace.</p>
  
  <p>So, my routes file looks like</p>
  
  <pre><code>scope '/:locale' do
    root 'admin#index', as: :root
    namespace :admin do
      resources :foos
    end
  end
  </code></pre>
  
  <p>In my ApplicationController, I have</p>
  
  <pre><code>before_action :set_locale
  
  def set_locale
    I18n.locale = params[:locale] || I18n.default_locale
  end
  def default_url_options(options={})
    { locale: I18n.locale }
  end
  </code></pre>
  
  <p>If I "rake routes", I got the following</p>
  
  <pre><code>root GET    /                     admin#index
       GET    /:locale(.:format)    admin#index
  admin_foos GET    /:locale/admin/foos(.:format)  admin/foos#index
  </code></pre>
  
  <p>And I can reach /en/admin/foos</p>
  
  <p>The problem I'm facing, is that if I print a path within a view, (even the path from my form, ...) I will get the path /admin/foo?locale=en. And this url with end with a 404.</p>
  
  <p>The calls to the path are simple such</p>
  
  <pre><code>&lt;%= link_to 'Back', admin_foos_path %&gt;
  </code></pre>
  
  <p>I guess I'm missing something, but have no idea of what.
  Any help will be appreciated !</p>
  
  <p>Regards,
  Benjamin</p>