Has_many ... through Association

Hi,

Let’s say I have 4 models: City, Line, Direction, Message
City ha many lines
lines has many directions
and direction has many message

Tell me if what’s next is correct
Line as many messages through line
City has many messages throufh line

Is this possible especially for the city model? Is this the correct way
to access messages from city?

Greg

Tell me if what’s next is correct
Line as many messages through line
No
City has many messages throufh line
No

City ha many lines
Line has many directions
Direction has many messages
+
City has many directions through lines
City has many messages through directions

This will allow you to do access a city’s messages directly with
city.messages.

For this you would need the “nested has many through” gem, as rails
cannot use “has many through” more than one level deep.