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',
  'deleted_at'
]

Instance Method Summary collapse

Instance Method Details

#publish!Object



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

def publish!
  update_attribute :is_published, true
end

#template_id=(id) ⇒ Object



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

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



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

def unpublish!
  update_attribute :is_published, false
end