The systemmessage_validtimes has a ‘has_many’ relationship with
systemmessages, meaning that there could be many valid times for each
system message. @systemMessage = Systemmessage.find(1)
E.g. I can access a system valid time like this :
@systemMessage.systemmessage_datetimeranges[0].id
I went ahead and made systemmessage_validtimes belong_to locations. But
when I try to access the locations variable, it doesn’t exist. The
location object isn’t being joined into the return object. I can
retireve
the location_id, but the following fails :
I went ahead and made systemmessage_validtimes belong_to locations. But
when I try to access the locations variable, it doesn’t exist. The
location object isn’t being joined into the return object. I can retireve
the location_id, but the following fails :
Above you speak about belongs_to locations. I think you mean belongs_to
location. Singular.
I am stupid. I was doing a find(@id) on the record, and I should have
been calling my model function,
Systemmessage.findSystemMessage(@id)
Calling the model function seems to transcribe the heirarchy correctly.
So, you have to implement a find function in your model to transcribe
the full data set (a standard find() on the model won’t do this)?