title: Rails action controller routing error
body: <p>I try to add an administration area to my website. So I added a namespace that contains the controllers "posts" and "category".
  In the routes.rb file, I added </p>
  
  <pre><code>namespace :admin do
   resources :posts , :categories
   match '/' =&gt; 'posts#index', :via =&gt; :get
  end
  </code></pre>
  
  <p>but with the url:</p>
  
  <blockquote>
    <p>myurl.com/admin </p>
  </blockquote>
  
  <p>i have error:</p>
  
  <blockquote>
    <p>No route matches {:controller=>"admin/site", :action=>"home", :locale=>:fr}</p>
  </blockquote>
  
  <p>It seems that another route is called and overwrites the one I added</p>
  
  <p>but in rake routes i have: </p>
  
  <blockquote>
    <p>admin GET    /admin(.:format) admin/posts#index</p>
  </blockquote>
  
  <p>Here the complete rake routes:</p>
  
  <pre><code>    faq GET    (/:locale)/faq(.:format)                    site#faq {:locale=&gt;/[a-zA-Z]{2}/}
                rules GET    (/:locale)/rules(.:format)                  site#rules {:locale=&gt;/[a-zA-Z]{2}/}
       advanced_rules GET    (/:locale)/advanced_rules(.:format)         site#advanced_rules {:locale=&gt;/[a-zA-Z]{2}/}
             play_now GET    (/:locale)/play_now(.:format)               play#play {:locale=&gt;/[a-zA-Z]{2}/}
                 play GET    (/:locale)/play(.:format)                   site#play {:locale=&gt;/[a-zA-Z]{2}/}
                 home GET    (/:locale)/home(.:format)                   site#home {:locale=&gt;/[a-zA-Z]{2}/}
                      GET    (/:locale)/qrcode(/:code)(.:format)         site#qrcode {:locale=&gt;/[a-zA-Z]{2}/}
      forgot_password GET    (/:locale)/forgot_password/:id(.:format)    passwords#forgot_password {:locale=&gt;/[a-zA-Z]{2}/}
     android_redirect GET    (/:locale)/android_redirect(.:format)       android#index {:locale=&gt;/[a-zA-Z]{2}/}
   general_conditions GET    (/:locale)/general_conditions(.:format)     site#general_conditions {:locale=&gt;/[a-zA-Z]{2}/}
              support GET    (/:locale)/support(.:format)                site#support {:locale=&gt;/[a-zA-Z]{2}/}
                      GET    (/:locale)/invitation(/:source)(.:format)   invitation#redirection {:locale=&gt;/[a-zA-Z]{2}/}
        release_notes GET    (/:locale)/release_notes(.:format)          site#release_notes {:locale=&gt;/[a-zA-Z]{2}/}
         release_note GET    (/:locale)/release_notes/:version(.:format) release_notes#show {:locale=&gt;/[a-zA-Z]{2}/}
                 root GET    /(:locale)(.:format)                        site#home {:locale=&gt;/[a-zA-Z]{2}/}
          admin_posts GET    /admin/posts(.:format)                      admin/posts#index
                      POST   /admin/posts(.:format)                      admin/posts#create
       new_admin_post GET    /admin/posts/new(.:format)                  admin/posts#new
      edit_admin_post GET    /admin/posts/:id/edit(.:format)             admin/posts#edit
           admin_post GET    /admin/posts/:id(.:format)                  admin/posts#show
                      PUT    /admin/posts/:id(.:format)                  admin/posts#update
                      DELETE /admin/posts/:id(.:format)                  admin/posts#destroy
     admin_categories GET    /admin/categories(.:format)                 admin/categories#index
                      POST   /admin/categories(.:format)                 admin/categories#create
   new_admin_category GET    /admin/categories/new(.:format)             admin/categories#new
  edit_admin_category GET    /admin/categories/:id/edit(.:format)        admin/categories#edit
       admin_category GET    /admin/categories/:id(.:format)             admin/categories#show
                      PUT    /admin/categories/:id(.:format)             admin/categories#update
                      DELETE /admin/categories/:id(.:format)             admin/categories#destroy
                admin GET    /admin(.:format)                            admin/posts#index
            completed GET    /payment_completed(.:format)                payment#completed
              android GET    /android(.:format)                          hockeyapps#android
                login POST   /login(.:format)                            registrations#login
        loginfacebook POST   /loginfacebook(.:format)                    registrations#loginfacebook
               status GET    /status(.:format)                           registrations#status
               logout DELETE /logout(.:format)                           registrations#logout
               geturl POST   /geturl/:id/:token(.:format)                paypals#geturl
            getstatus POST   /getstatus/:id/:token(.:format)             paypals#getstatus
    payment_completed GET    /payment_completed(.:format)                payment#completed
      forgot_password GET    /forgot_password/:id(.:format)              passwords#forgot_password
        send_password POST   /send_password(.:format)                    passwords#send_password
  </code></pre>
  
  <p>Here the complete file routes.rb:</p>
  
  <pre><code>  scope "(:locale)", :constraints =&gt; {:locale =&gt; /[a-zA-Z]{2}/} do
  
      match '/faq' =&gt; 'site#faq', :via =&gt; :get
  
      match '/rules' =&gt; 'site#rules', :via =&gt; :get
  
      match '/advanced_rules' =&gt; 'site#advanced_rules', :via =&gt; :get
  
      match '/play_now' =&gt; 'play#play', :via =&gt; :get
      match '/play' =&gt; 'site#play', :via =&gt; :get
  
      match '/home' =&gt; 'site#home', :via =&gt; :get
      match '/qrcode/(:code)' =&gt; 'site#qrcode', :via =&gt; :get
  
      match '/forgot_password/:id' =&gt; 'passwords#forgot_password', :via =&gt; :get, :as =&gt; "forgot_password"
      match '/android_redirect' =&gt; 'android#index', :via =&gt; :get, :as =&gt; "android_redirect"
  
      match '/general_conditions' =&gt; "site#general_conditions", :via =&gt; :get
  
      match '/support' =&gt; "site#support", :via =&gt; :get
  
      match '/invitation/(:source)' =&gt; 'invitation#redirection', :via =&gt; :get
  
      match '/release_notes' =&gt; 'site#release_notes', :via =&gt; :get, :as =&gt; "release_notes"
      match '/release_notes/:version' =&gt; 'release_notes#show', :via =&gt; :get, :as =&gt; "release_note"
  
      root :to =&gt; 'site#home', :via =&gt; :get
    end
  
    namespace :admin do
      resources :posts , :categories
      match '/' =&gt; 'posts#index', :via =&gt; :get
    end
  
    get 'payment_completed' =&gt; 'payment#completed', :as =&gt; "completed"
  
    get 'android' =&gt; 'hockeyapps#android', :as =&gt; 'android'
  
  
    post 'login' =&gt; 'registrations#login', :as =&gt; 'login'
    post 'loginfacebook' =&gt; 'registrations#loginfacebook', :as =&gt; 'loginfacebook'
    get 'status' =&gt; 'registrations#status', :as =&gt; 'status'
    delete 'logout' =&gt; 'registrations#logout', :as =&gt; 'logout'
  
    post 'geturl/:id/:token' =&gt; 'paypals#geturl', :as =&gt; 'geturl'
    post 'getstatus/:id/:token' =&gt; 'paypals#getstatus', :as =&gt; 'getstatus'
  
    get 'payment_completed' =&gt; 'payment#completed', :as =&gt; 'payment_completed'
  
    #scope :protocol =&gt; 'https://', :constraints =&gt; { :protocol =&gt; 'https://' } do
    #  resources :passwords
    #end
    get 'forgot_password/:id' =&gt; 'passwords#forgot_password', :as =&gt; 'forgot_password'
    post 'send_password' =&gt; 'passwords#send_password', :as =&gt; 'send_password'
  end
  </code></pre>
  
  <p>Any idea about the problem ?</p>
  
  <p>thanks</p>