JoshK wrote:
> Hi I have a table where I need to identify one of the children as the
> "prime" child.
> 
> So, its like:
> 
> Parent
>   has_many :Child
>   has_one: Child :as :prime_child (?)
> 
> or something like that? Do I put something like prime_child_id in the
> Parent table?
> Thanks.

Yes.  You should be able to do
class Parent < AR::B
  has_many :children # not :Child !
  has_one :prime_child, :class_name => 'Child'
end

The two associations are completely independent.  The fact that they 
refer to the same child class and table is irrelevant.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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 [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