Used this which only found parent records with children.

self.all( :conditions => { :type => :duplicate } ).parent_items.each
do | r |
  a.push r
end


On Apr 20, 5:28 pm, tenstates <[email protected]> wrote:
> Hi
>
> I had decided to usehttp://github.com/snusnu/dm-is-self_referential
> but am having trouble isolating records without children due to the
> absence of a foreign key in my model to map the values of the join
> table by.
>
> is :self_referential, :through => 'Publication',
>   :children    => :child_items,          # item_child_items
>   :parents     => :parent_items,       # item_parent_items
>   :source      => :parent_items,       # parent_items
>   :target        => :child_item,           # child_items
>   :order        => [ :published_at.desc ],
>   :constraint => :destroy
>
> Is there a clean way to say something like this below but in reverse
> so as to only get back those results without children? I have tried a
> number of combination's, but really need some pointers.
>
> item = Item.all
> item.child_items.each { | child | item.object_id ==
> child.parent_items.object_id }
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" 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 
> athttp://groups.google.com/group/datamapper?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to