What Model Association?

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?

Thanks in advance!

Mark

On 4 April 2012 22:39, Mark 01 [email protected] 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.

I just realized CarWashStation might be misleading. Each station refers
to one “activity location” that the car mush move through per wash. A
few example instances might be:

  • Soap Application Station
  • Bristle Brush Station
  • Wax Station
  • Dry Station

On 5 April 2012 01:54, Mark P. [email protected] wrote:

I just realized CarWashStation might be misleading. Each station refers
to one “activity location” that the car mush move through per wash. A
few example instances might be:

  • Soap Application Station
  • Bristle Brush Station
  • Wax Station
  • Dry Station

That sounds like a CarWashing should have a state-machine to manage
transitions between stations (rather than stations being models of
their own).
You could have sub-types of CarWashing that would provide different
combinations of states (for the simple Wash’n’Wax to the full-on
hand-finished-chamois-wipe-down-with-under-body-jet-wash).

I’ll look into what a state machine is. Thanks for that.

Each station currently has many to do items as well as a uptime status
and employees operating in that station. Does it still make sense for
stations to not be their own model?

The car exists independently of a CarWashStation.

A CarWashStation can perform these [Enumerated] functions on a Class of
Vehicle [such as a car].

Version 0.

On 4 April 2012 17:39, Mark 01 [email protected] wrote:

Thanks in advance!
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.


Charles A. Lopez
[email protected]

What’s your vision for your organization?
What’s your biggest challenge?

Let’s talk.
(IBM Partner)