Sha256: 9d89465b72133726c1e3af00a5df2284b47f0bc676f570f3562ff7485686ebcb

Contents?: true

Size: 756 Bytes

Versions: 4

Compression:

Stored size: 756 Bytes

Contents

module Ecm::Cms
  class Page::ContentBlock < ActiveRecord::Base
    # associations
    belongs_to :ecm_cms_content_box, :class_name => 'ContentBox',
                                     :foreign_key => 'ecm_cms_content_box_id'
    belongs_to :ecm_cms_page, :class_name => 'Ecm::Cms::Page',
                              :foreign_key => 'ecm_cms_page_id'

    # attributes
    attr_accessible(:body,
                    :ecm_cms_content_box_id) if Rails.version < '4.0.0'

    # validations
    validates :body, :presence => true
    validates :ecm_cms_content_box, :presence => true
    validates :ecm_cms_page, :presence => true
    # validates :ecm_cms_page, :existence => true

    def content_box_name
      ecm_cms_content_box.name
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ecm_cms2-1.1.1 app/models/ecm/cms/page/content_block.rb
ecm_cms2-1.1.0 app/models/ecm/cms/page/content_block.rb
ecm_cms2-1.0.1 app/models/ecm/cms/page/content_block.rb
ecm_cms2-1.0.0 app/models/ecm/cms/page/content_block.rb