Ruby on Rails
Friday, June 8, 2012
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: :parentIf you do: root.children.where(:type => yourtype) it should just work.
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 propertycalled type.the root categories have no type but the children have. so how I can getall the roots with filled in children that have category type = 'B' forinstance.I tried to run Category.roots then delete children With a category notequal to 'B' but this causes a major performance problems.how to call roots with filter children?best regardsIbrahim--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.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment