Ruby on Rails Thursday, March 19, 2015

Hello! Please help with trouble (I think it must be obvious solution)

I have code for displaying main menu:

@main_menu = Page.where(active: true).arrange(order: :position)

It grabs all nodes with active parameter is set to true. But if the parent node for some children is set to active:false, they connects to grandparent node, and so on. How to avoid this behavior, so if parent node is excluded then all children nodes become excluded too?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/239ec8c9-0810-4240-af8a-e915cdd966e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment