Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:15:24+00:00 2026-06-15T08:15:24+00:00

I regularly use shallow routes on nested resources , so thought I missed something

  • 0

I regularly use shallow routes on nested resources, so thought I missed something simple, but don’t see why I’m getting a routing error for students#show.

I have a School with two nested resources: Courses and Students. All actions work on Courses. The :index, :new and :create actions work for Students.

Why do I get a routing error for /students/3 instead of being routed to students#show as indicated in rake routes?

exception on /students/3 :

Routing Error
No route matches {:controller=>"students"}

Try running rake routes for more information on available routes.

Here are the relevant bits…

rake routes output:

...
            school_students GET    /schools/:school_id/students(.:format)     students#index
                            POST   /schools/:school_id/students(.:format)     students#create
         new_school_student GET    /schools/:school_id/students/new(.:format) students#new
               edit_student GET    /students/:id/edit(.:format)               students#edit
                    student GET    /students/:id(.:format)                    students#show
                            PUT    /students/:id(.:format)                    students#update
                            DELETE /students/:id(.:format)                    students#destroy
             approve_course GET    /courses/:id/approve(.:format)             courses#approve
             publish_course GET    /courses/:id/publish(.:format)             courses#publish
             school_courses GET    /schools/:school_id/courses(.:format)      courses#index
                            POST   /schools/:school_id/courses(.:format)      courses#create
          new_school_course GET    /schools/:school_id/courses/new(.:format)  courses#new
                edit_course GET    /courses/:id/edit(.:format)                courses#edit
                     course GET    /courses/:id(.:format)                     courses#show
                            PUT    /courses/:id(.:format)                     courses#update
                            DELETE /courses/:id(.:format)                     courses#destroy
                    schools GET    /schools(.:format)                         schools#index
                            POST   /schools(.:format)                         schools#create
                 new_school GET    /schools/new(.:format)                     schools#new
                edit_school GET    /schools/:id/edit(.:format)                schools#edit
                     school GET    /schools/:id(.:format)                     schools#show
                            PUT    /schools/:id(.:format)                     schools#update
                            DELETE /schools/:id(.:format)                     schools#destroy
...

routes.rb

Lms::Application.routes.draw do
...
resources :schools, :shallow => true do
  resources :students
  resources :courses do         # Courses still work if I remove this block.
    member do
      get 'approve'
      get 'publish'
    end
  end
end
...

controllers and views

I inspected, but since this is a routing exception, I don’t think this code is reached. If you tell me otherwise, I can add them.

libraries

I’m using cancan with authlogic, but have never experienced a routing error from these.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:15:25+00:00Added an answer on June 15, 2026 at 8:15 am

    Yes, it was something simple. I made a wrong assumption that a routing error means the controller and views aren’t reached….and this “genius” forgot the logs have the full stack trace:

    Completed 500 Internal Server Error in 89ms
    
    ActionController::RoutingError (No route matches {:controller=>"students"}):
      app/views/shared/_breadcrumbs.html.erb:27:in `_app_views_shared__breadcrumbs_html_erb___658518109680707361_70357170598800'
      app/views/layouts/application.html.erb:45:in `_app_views_layouts_application_html_erb__2976677320852012228_70357170792580'
      app/controllers/students_controller.rb:19:in `show'
    

    My breadcrumbs was attempting to construct a link to students#index which doesn’t exist. The breadcrumbs try to handle this case (line 25) but the check fails for nested resources:

    25: <% elsif controller.class.action_methods.include?('index') %>
    26:   <li>
    27:     <%= link_to controller_name.titleize, :controller => controller_name, :action => 'index' %>
    28:     <span class="divider">/</span>
    29:   </li>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't use Python regularly, but now I have to. I should run a
I have a test I have to use regularly in queries to see if
I have read about Java enums and use them regularly. However, I don't understand
I use ON DELETE CASCADE regularly but I never use ON UPDATE CASCADE as
I use VIM pretty regularly now but I never use the dot (.) command
I use CSS transitions fairly regularly and for some reason I cannot get them
I have a WinForms utility that I use constantly, and enhance regularly. Roughly one
I don't usually use regular expressions, hence my question. I need a regex to
In my bash scripts, I regularly use file paths which may contain spaces: FOO=/path\
i have a shared template that i use regularly to show errors like :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.