Note that there are some explanatory texts on larger screens.

plurals
  1. POrails 3 namespaced controller and routing
    text
    copied!<p>I am having problem with namespaced controller and routing. I have following namespaced route.</p> <pre><code> namespace :institution do resources :students end </code></pre> <p>along with </p> <pre><code> resources :students, :only =&gt; [] do resources :college_selections, :only =&gt;[:index, :create, :update] resources :progress, :only =&gt; [:index] do collection {get 'compare'} end resources :marks end </code></pre> <p>it generated the following routes</p> <pre><code> institution_students GET /institution/students(.:format) {:action=&gt;"index", :controller=&gt;"institution/students"} POST /institution/students(.:format) {:action=&gt;"create", :controller=&gt;"institution/students"} new_institution_student GET /institution/students/new(.:format) {:action=&gt;"new", :controller=&gt;"institution/students"} edit_institution_student GET /institution/students/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"institution/students"} institution_student GET /institution/students/:id(.:format) {:action=&gt;"show", :controller=&gt;"institution/students"} PUT /institution/students/:id(.:format) {:action=&gt;"update", :controller=&gt;"institution/students"} DELETE /institution/students/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"institution/students"} </code></pre> <p>I have a students controller inside institution directory in apps directory. And it has following structure.</p> <pre><code>class Institution::StudentsController &lt; ApplicationController before_filter :require_login load_and_authorize_resource .......... ......... end </code></pre> <p>Now when i tried to redirect to students show page with a link_to helper method as shown below</p> <pre><code>&lt;%= link_to "show", institution_student_path(student) %&gt; </code></pre> <p>then it showed wired kind of link with a period(.) in it. Say the student id is 100 and it generated the routes like this</p> <pre><code>institution/students/4.100 </code></pre> <p>here 4 is current institution id i guess. Why is such routes being generated.</p> <p>And when i click on show link it gave me error saying</p> <pre><code>Expected /home/gagan/projects/App_name/app/Institution/students_controller.rb to define StudentsController </code></pre> <p>What am i missing here.</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload