Sunday, July 22, 2012

[Rails] Multiple associations to the same model

I have a model which contains a large dataset which is unmodifiable. I
contains a relation of ids to names for several item types lumped
together, not idea I know.

I have a model which needs two associations, both of which will link to
this model above, but with different names.

For example, lets say the dataset contains a list of furniture. Ids 1-10
might be tables and 11-20 might be chairs.

Lets say the other model defines a room. A room should be able to have
one table and one chair. Unfortunately, as they both refer to the same
model, I'm a loss on how to do it. Not even sure if it's possible, which
will be a real pain as I can't modify the larget dataset at all.

Grateful for some pointers, if anyone actually understands my problem :)

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate