title: Namespaced controller redirect urls
body: <p>i have probably a simple question. I have created a namespace <code>panel</code> with <code>categories</code> controller.</p>
  
  <p>After creating or editing a category, rails redirects me to <code>website.com/categories/:id</code> instead of <code>website.com/panel/categories/:id</code>.</p>
  
  <p>I've noticed that in the _form view, the <code>@panel_categories</code> argument of <code>form_for()</code> function points to <code>/categories</code> nor <code>/panel/categories</code> and that's causing this behaviour. Offcourse i can add a <code>:url =&gt; '/panel/categories'</code> param but i feel that it's not the best solution...</p>
  
  <p>Can you provide me any better solution? </p>
  
  <p>Thanks in advance</p>
  
  <p><strong>Files:</strong></p>
  
  <p><code>routes.rb:</code></p>
  
  <pre><code>Photowall::Application.routes.draw do
    resources :photos
  
    resources :categories
  
    resources :fields
  
    resources :users, :user_sessions
    match 'login'  =&gt; 'user_sessions#new',     :as =&gt; :login
    match 'logout' =&gt; 'user_sessions#destroy', :as =&gt; :logout
  
    namespace :panel do
      root :to =&gt; "photos#index"
      resources :users, :photos, :categories, :fields
    end
  
    namespace :admin do
      root :to =&gt; "users#index"
      resources :users, :photos, :categories, :fields
    end
  end
  </code></pre>
  
  <p><code>categories_controller.rb:</code></p>
  
  <p><a href="http://pastebin.com/rWJykCCF" rel="nofollow">http://pastebin.com/rWJykCCF</a></p>
  
  <p><code>model</code> is the default one</p>
  
  <p><code>form:</code></p>
  
  <p><a href="http://pastebin.com/HGmkZZHM" rel="nofollow">http://pastebin.com/HGmkZZHM</a></p>