[Rails] Re: association to an association
i had not thought of a polymorphic association.
works good and does what i needed.
Ar Chron wrote:
> Gone Sail wrote:
>> right this sounds like what i need to do. so your association tables (AB
>> and AC) have their own unique ids? Xlink is the polymorphic link from AB
>> and AC to the X table elements? so the Xlink table will have an
>> xlinkable type and id along with the X table id? thanks.
>
> Yup.
>
> AB or AC would have:
> id
> a_id
> b_id or c_id
> plus other fields
>
> xlink would have:
> id (the xlink record id)
> x_id (the id of the related X record)
> xlinkable_id (this is the id of the AB/AC join record)
> xlinkable_type (this is the class name "AB"/"AC" of the join record)
--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home