Say, I have models and associations like
Plan :flight_name_id: integer
FlightName :departure_id :integer
Place :city_id :integer
City :name :string
Plan 1–n FlightName n–1 Place n–1 City
Apparently, a flight_name has connections to TWO places, where one of
them refers to departure_id and another to destination_id.
Corresponding place.id’s are stored in them.
In a view, I would like to generate City.name’s (string) for both
departure place and destination place.
My question is: How can I achieve this?
in a view (html.erb template)
gives an error, “undefined method `place’ for” obviously.
I am guessing that a custom method needs to be defined in order to pull
out City,name from a Plan.
Can anyone give me advice?