Class: Landable::TemplateRevision

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
TableName
Defined in:
app/models/landable/template_revision.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#publish!Object



34
35
36
# File 'app/models/landable/template_revision.rb', line 34

def publish!
  update_attribute :is_published, true
end

#template_id=(id) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'app/models/landable/template_revision.rb', line 23

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

#unpublish!Object



38
39
40
# File 'app/models/landable/template_revision.rb', line 38

def unpublish!
  update_attribute :is_published, false
end