Sha256: 73d6a09ca0dfd2e5b08898d3a21b3894e3b05c4fe534857609675cf7f96b5421
Contents?: true
Size: 768 Bytes
Versions: 14
Compression:
Stored size: 768 Bytes
Contents
module Cmor::Cms class Page < ActiveRecord::Base # add shared behaviour for database backed templates include Cmor::Cms::DatabaseTemplate # associations has_many :navigation_items, dependent: :nullify has_many :content_blocks, dependent: :destroy, inverse_of: :page accepts_nested_attributes_for :content_blocks, allow_destroy: true # publishing include ActsAsPublished::ActiveRecord acts_as_published # callbacks after_save :touch_navigation_items # validations validates :title, presence: true def home_page? pathname == '/' && basename == 'home' end def touch_navigation_items navigation_items.map(&:update_url_form_page!) end end end
Version data entries
14 entries across 14 versions & 1 rubygems