This is how children is defined[1]:
has_many :children, class_name: name,
foreign_key: configuration[:foreign_key],
order: configuration[:order],
dependent: configuration[:dependent],
inverse_of: :parent
If you do: root.children.where(:type => yourtype) it should just work.
https://github.com/amerine/acts_as_tree/blob/master/lib/acts_as_tree.rb#L7
(https://github.com/amerine/acts_as_tree/blob/master/lib/acts_as_tree.rb#L89)8
--
Oscar Del Ben
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Friday, June 8, 2012 at 7:18 AM, ibrahim hassan wrote:
> Hello Experts,
> I have a tree of categories in this category object there is a property
> called type.
> the root categories have no type but the children have. so how I can get
> all the roots with filled in children that have category type = 'B' for
> instance.
> I tried to run Category.roots then delete children With a category not
> equal to 'B' but this causes a major performance problems.
>
> how to call roots with filter children?
>
>
> best regards
> Ibrahim
>
> --
> 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]
> (mailto:[email protected]).
> To unsubscribe from this group, send email to
> [email protected]
> (mailto:[email protected]).
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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.