title: Rails nesting from the CoreController. Troubles with routing
body: <p>I have some user types such as Student, Teacher, Admin. For each user type I have a controller. For instance student controllers placed in the <code>app/controllers/students</code> directory. But mostly controllers are the same. Because of this I created <strong>core controllers</strong> placed in the <code>app/controllers/core</code>. </p>
  
  <p><strong>app/controllers/core/settings_controller.rb</strong></p>
  
  <pre><code>class Core::SettingsController &lt; ApplicationController
  
    def show
      # instance variables, redirections etc. placed here...
      #
    end
  
    # other actions...
    #
  end
  </code></pre>
  
  <p><strong>app/controllers/student/settings_controller.rb</strong></p>
  
  <pre><code>class Student::SettingsController &lt; Core::SettingsController
  
  end
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>namespace :student do
    # ...
    resource :schedule, :only =&gt; [:show]
    resource :settings, :only =&gt; [:show, :update]
  end
  
  namespace :admin do
    # ...
    resource :settings, :only =&gt; [:show, :update]
  end
  </code></pre>
  
  <p>Problems started when I added <code>&lt;%= link_to "&lt;", schedule_path(:date =&gt; @date.prev_month)" %&gt;</code> to my <code>views/core/settings/_month_nav.html.erb</code> file.</p>
  
  <p>Is there any solution except writing this ugly peaces of code: </p>
  
  <pre><code>&lt;% if admin? %&gt;
    &lt;%= link_to "&lt;", admin_schedule_path ... %&gt;
  &lt;% elsif student? %&gt; 
    &lt;%= link_to "&lt;", student_schedule_path ... %&gt;
  ...
  </code></pre>