ara.t.howard wrote:
> given a setup like
> 
> class Parent
>   has_many :child_parents
>   has_many :children, :through => child_parents
> end
> 
> and assuming i'd like to store the style of relationship on the
> child_parents table, for example
> 
> create table child_parents(
>   parent_id
>   child_id
>   is_adopted
> )
> 
> in otherwords, 'is_adopted' is an attribute of the link between child
> and parent, not of the child or parent themselves, how can one access
> this simply?
> 
> child = parent.children.first
> p child.adopted?

cp = parent.child_parents.first
child = cp.child
p cp.adopted?

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to