Sha256: 52423fa6fa377e6a1b9c72ee22406c0ae9ee8311b3ea8044a6fb5f9894a7f853

Contents?: true

Size: 921 Bytes

Versions: 12

Compression:

Stored size: 921 Bytes

Contents

module Landable
  class TemplateRevision < ActiveRecord::Base
    include Landable::TableName

    @@ignored_template_attributes = [
      'editable',
      'created_at',
      'updated_at',
      'published_revision_id',
      'file',
      'thumbnail_url',
      'is_layout',
      'is_publishable',
      'audit_flags',
      'deleted_at'
    ]

    cattr_accessor :ignored_template_attributes

    belongs_to :template, inverse_of: :revisions
    belongs_to :author

    def template_id=(id)
      # set the value
      self[:template_id] = id

      # copy attributes from the template
      self.name          = template.name
      self.body          = template.body
      self.description   = template.description
      self.slug          = template.slug
    end

    def publish!
      update_attribute :is_published, true
    end

    def unpublish!
      update_attribute :is_published, false
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
landable-1.13.1 app/models/landable/template_revision.rb
landable-1.12.3 app/models/landable/template_revision.rb
landable-1.12.2 app/models/landable/template_revision.rb
landable-1.12.1 app/models/landable/template_revision.rb
landable-1.11.1 app/models/landable/template_revision.rb
landable-1.11.0 app/models/landable/template_revision.rb
landable-1.10.0.rc2 app/models/landable/template_revision.rb
landable-1.10.0.rc1 app/models/landable/template_revision.rb
landable-1.9.2 app/models/landable/template_revision.rb
landable-1.9.1 app/models/landable/template_revision.rb
landable-1.9.0 app/models/landable/template_revision.rb
landable-1.9.0.rc2 app/models/landable/template_revision.rb