Sha256: 0deef71df52bbc4b78e6af9bbd3eabf821e732f736bd5f03f7487d741695900a

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

module RailsConnector

  class Revision < CmsBaseModel
    self.key_prefix = "rev"

    property :generation
    property :base_revision_id
    property :title
    property :content_cache_id
    property :editable

    def self.current=(revision_or_proc)
      raise "Do not use Revision.current=, use Workspace.current= instead."
    end

    def self.current
      raise "Do not use Revision.current, use Workspace.current instead."
    end

    def self.find_by_label(label_name)
      workspace = Workspace.find(label_name)
      find(workspace.revision_id)
    end

    def chain
      @chain ||= Chain.build_for(self, content_cache)
    end

    def invalidate_chain
      @chain = nil
    end

    # returns the base revision or nil for an initial revision
    def base_revision
      @base_revision ||= base_revision_id ? Revision.find(base_revision_id) : nil
    end

    # returns the content cache to be used with this revision or nil if not available
    def content_cache
      if content_cache_id
        if @content_cache && content_cache_id == @content_cache.id
          @content_cache
        else
          @content_cache = ContentCache.find_by_id(content_cache_id)
        end
      end
    end

    def inspect
      "<#{self.class} id=\"#{id}\" title=\"#{title}\">"
    end

    def obj_classes
      rtc['obj_classes']
    end

    def attributes
      rtc['attributes']
    end

    def rtc_id
      rtc_ref['id']
    end

    private

    def rtc
      @rtc ||= DictStorage.get(rtc_ref)
    end

    def rtc_ref
      read_attribute('rtc_ref')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.3.115.227021242 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.3.73.75172665 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.3.2.153416031 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.3.67.110847540 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.3.1.23895778 lib/rails_connector/revision.rb