Ruby on Rails
Friday, March 20, 2015
This is the model:
-- class Page
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Ancestry
include Mongoid::Orderable
has_ancestry orphan_strategy: :destroy
orderable column: :position, base: 0
has_many :page_attachment_files
field :name, type: String
field :content, type: String
field :elements_order, type: String, default: "nav,anounces,news,page_content,albums,paf"
field :show_in_main_menu, type: Boolean, default: true
field :active, type: Boolean, default: true
field :redirect, type: String
validates :name, presence: true
end
When all nodes has attribute active set to :true (like on picture)
Then all menu on site looks correct
But if set one of parent nodes "active" to false (like that)
Then menu breaks: all child nodes are attached to grandparent node (Like this):
And I need to exclude all this child nodes if parent node is disabled. How to do that?
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/9880377e-f2ff-439a-8f25-36884ba3c7bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)




No comments:
Post a Comment