title: Rails routes with optional scope ":locale"
body: <p>I'm working on a Rails 3.1 app and I'd like to set specific routes for the different languages the app is going to support.</p>
  
  <pre><code>/es/countries
  /de/countries
  …
  </code></pre>
  
  <p>For the default language ('en'), I don't want the locale to be displayed in the url.</p>
  
  <pre><code>/countries
  </code></pre>
  
  <p>Here is the route definition I've set.</p>
  
  <pre><code>scope "(:locale)", :locale =&gt; /es|de/ do
     resources :countries
  end
  </code></pre>
  
  <p>It works great, until I try to use a path helper with 'en' as the locale.</p>
  
  <p>In the console : </p>
  
  <pre><code>app.countries_path(:locale =&gt; 'fr')
   =&gt; "/fr/countries" 
  
  app.countries_path(:locale =&gt; 'en')
   =&gt; "/countries?locale=en" 
  </code></pre>
  
  <p>I don't want the "?locale=en".</p>
  
  <p>Is there a way to tell rails that with an 'en' locale, the locale param should not be added to the url? </p>
  
  <p>Thanks</p>