Sha256: 53b19ad0e42c8d7130596a5089388b7a6a8a714760aae0580a2a9b7b104bd8fd

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

#:enddoc:
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

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.210.ed204b0 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.110.6570b45 lib/rails_connector/revision.rb