Newbie question attribute from associated table not showing up in index view
Posted
by Lauren
on Stack Overflow
See other posts from Stack Overflow
or by Lauren
Published on 2009-07-18T17:33:08Z
Indexed on
2010/05/09
2:08 UTC
Read the original article
Hit count: 214
Hi I know this is something simple I am doing wrong.
I have three tables, installation, neighborhood, schools
Installation:
has_many :schools
has_many :neighborhoods
Neighborhood:
has_many :installations
has_many :schools
Schools:
belongs_to :installations
belongs_to :neighborhoods
I can't figure out how to show the name of the neighborhood the school is located in on the index view. I can get it to show on the show view once I have the school id. But on the index view I can't figure out what to put in the controller that will allow me to access the neighborhood name from the neighborhood_id that is in the School model. I am sure this is so easy and I am screwing up something stupid.
HELP!
© Stack Overflow or respective owner