Hello,
I have following models:
States has_many Cities
Cities has_many Streets
Streets has_many Houses
Houses has_many People
In the routes.rb I have all these set as nested resources so I can view
all
the Cities of specific State as /states/1/cities, all the Streets of
given
City as /cities/15/streets, all the Streets of specific State as
/states/27/streets, etc.
Now in the houses#show action I would like to list all the People in
this
House. In the streets#show I would like to list all the Houses and all
the
People in this Street, and the same for cities#show and states#show
I would like to be DRY, so when there is a code for listing People in
people#index action, I would like to somehow render /houses/1/people in
the
houses#show, /streets/123/houses and /streets/123/people in
streets#show,
etc. Without the layout.
But how?
When I call render :template => "/houses/123/people"
the Rails throws
an
error that there is no such template.
Thank you for your time.
-Petr