Weird relationship thing


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Pete W. wrote:

adding a method to the House class that I pass a user id into?



Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Thinking about the relationships (rather than representing in AR), I
think there is a difference between owning a house (which is also a
container, as may be an office, or storage place, also the user may own
more than one house), and movable objects (possessions). I would think
the relationship between these containers (ugly name!) and possessions
is one of location, i.e. a container has_one location, a possession
has_one location, a location belongs_to a possession and belongs_to a
location, and a container has_many possessions through location.

Of course you could model the container-possession relationship as a
has_and_belongs_to_many, but I suspect you will want to add attributes
to the relationship, such as when it began (i.e. when it was moved
there), and when it ended.

HTH


Rails mailing list
[email protected]domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs