Sha256: c9936a53b4701a0c92fc4c1c0c7a66cd0d6e254c6cac147bf38c6559f93a408f

Contents?: true

Size: 572 Bytes

Versions: 11

Compression:

Stored size: 572 Bytes

Contents

module Smithy
  class ContentBlockTemplate < ActiveRecord::Base
    belongs_to :content_block, :touch => true
    has_many :page_contents

    validates_presence_of :name
    validates_uniqueness_of :name, :scope => :content_block_id
    validates_presence_of :content

    after_save :touch_page_contents

    default_scope -> { order(:name) }

    def liquid_template
      @liquid_template ||= ::Liquid::Template.parse(Smithy::AssetLink.fix(self.content))
    end

    private
      def touch_page_contents
        self.page_contents.each(&:touch)
      end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
smithycms-0.7.3 app/models/smithy/content_block_template.rb
smithycms-0.7.2 app/models/smithy/content_block_template.rb
smithycms-0.7.1 app/models/smithy/content_block_template.rb
smithycms-0.7.0 app/models/smithy/content_block_template.rb
smithycms-0.6.10 app/models/smithy/content_block_template.rb
smithycms-0.6.9 app/models/smithy/content_block_template.rb
smithycms-0.6.7 app/models/smithy/content_block_template.rb
smithycms-0.6.6 app/models/smithy/content_block_template.rb
smithycms-0.6.5 app/models/smithy/content_block_template.rb
smithycms-0.6.4 app/models/smithy/content_block_template.rb
smithycms-0.6.3 app/models/smithy/content_block_template.rb