user1175969
user1175969

Reputation: 570

Setting up a route that includes more than 1 resource id

I have 2 resources - Institute and Classroom. There is a has_many association between Institute and Classroom.

Please let me know how I can setup the following route for the "show" action in the Classrooms Controller:

institutes/<institute_id>/classrooms/<classroom_id>

Upvotes: 1

Views: 25

Answers (1)

jamesc
jamesc

Reputation: 12837

How about

resources :institutes do
  resources :classrooms
end

You might find it beneficial to look at the documentation on routes here

Upvotes: 1

Related Questions