Sha256: 1c72af7dee44900b6c9ac9a81d384f0e93af229b848af5b9b7857cf5472a7e29
Contents?: true
Size: 825 Bytes
Versions: 2
Compression:
Stored size: 825 Bytes
Contents
module Brightcontent module PageCore extend ActiveSupport::Concern included do attr_accessible :body, :name, :parent_id, :hidden acts_as_nested_set include Brightcontent::Attachable validates_presence_of :name after_save :update_slug end module ClassMethods def default_scope order(:lft) end end def homepage? lft == 1 end def path "/" + slug end def attachment_styles Brightcontent.page_attachment_styles 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.24 | app/models/brightcontent/page_core.rb |
brightcontent-pages-2.0.23 | app/models/brightcontent/page_core.rb |