2009/6/3 Marnen Laibow-Koser <[email protected]>:
>
> David wrote:
>> It seems like there may be a rails method for the following situation:
>> model User
>> has_many :appointments
>>
>> model Appointment
>> has_one :instruction
>> belongs_to :user
>>
>> model Instruction
>> belongs_to :appointment
>>
>> I would like to do User.Appointments.Instruction and return an array
>> with instruction objects
>
> Try User :has_many instructions, :through => appointments.  I think that
> will define User#instructions, which should do exactly what you want.
>

That's much better, I should have thought of that. I have learnt more
here attempting to answer questions than I have through the questions
I have asked myself.

Colin

> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to