Class: TemplateVersion

Inherits:
Version
  • Object
show all
Defined in:
app/models/template_version.rb

Overview

This class stores version text for Template. See Version for details.

Content

Uses TemplateContent.

Instance Attribute Summary

Attributes included from Zena::Use::Workflow::VersionMethods

#backup, #status_set, #stored_workflow

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Version

#author, #cloned, #mark_for_destruction, #node_with_secure, #previous_number

Methods included from Zena::Use::Workflow::VersionMethods

#clone_on_change?, #edited?, included, #should_clone?, #status=, #status_set?

Methods included from Zena::Use::Dates::ModelMethods

included

Methods included from Zena::Use::Dates::Common

#format_date

Class Method Details

.content_classObject

TODO: test



13
14
15
# File 'app/models/template_version.rb', line 13

def self.content_class
  TemplateContent
end

Instance Method Details

#contentObject

TODO: test



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/template_version.rb', line 18

def content
  return @content if @content
  @content = content_class.find_by_node_id(self[:node_id])

  unless @content
    # create new content
    @content = content_class.new
    @redaction_content = @content
    @content[:site_id] = node[:site_id]
  end
  @content.node = node
  @content
end

#redaction_contentObject

TODO: test



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

def redaction_content
  content
end