Sha256: 8e5bb5cbd740434ccaeeda5bb8509c02147b587e859acc6d31c18bcdc96c20f4
Contents?: true
Size: 820 Bytes
Versions: 2
Compression:
Stored size: 820 Bytes
Contents
module Brightcontent module PageCore extend ActiveSupport::Concern included do acts_as_nested_set has_attached_files Brightcontent.page_attachment_styles include Brightcontent::Attachable include TheSortableTree::Scopes validates_presence_of :name after_save :update_slug after_move :update_slug end module ClassMethods def default_scope order(:lft) end end def homepage? lft == 1 end def path "/" + slug end def root_parent_children root? ? children : ancestors.first.children end private def update_slug self.update_column(:slug, slug_name) end def slug_name homepage? ? "" : self_and_ancestors.map { |p| p.name.parameterize }.join("/") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
brightcontent-pages-2.0.33 | app/models/brightcontent/page_core.rb |
brightcontent-pages-2.0.31 | app/models/brightcontent/page_core.rb |