Wednesday, April 4, 2012

Re: [Rails] What Model Association?

On 4 April 2012 22:39, Mark 01 <lists@ruby-forum.com> wrote:
> I have the following two models and am not quite sure how they should be
> associated.
>
> - Car
> - CarWashStation
>
> At any given time, an instance of Car will be at (belong to?) one of a
> dozen car wash stations. What associations should I use (if any) between
> these models?


I would anticipate a CarWashing model, which has_one Car and one
CarWashStation, along with details about the time of the washing, what
soap was used, and which attendants conducted it (through an
AttendantsCarWashings join table), etc. A Car would then have many
CarWashings, and a named scope could give the current_car_washing.
Or something like that.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate