Sha256: 6a553363d284e9ad6aa7811b17fe0ace128f4fc1fee9d3de1e23ef772c993c70

Contents?: true

Size: 1.47 KB

Versions: 16

Compression:

Stored size: 1.47 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

    private

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.2.36.82613853 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.2.7.128454143 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.1.26.236500544 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.1 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.539.93842523 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.529.114081979 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.518.30999728 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.515.34928522 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.498.46559598 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.480.261594408 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.444.171626367 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.406.131718077 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.356.19698103 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.348.160665197 lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.328.4a753fc lib/rails_connector/revision.rb
infopark_cloud_connector-6.8.0.322.c003f11 lib/rails_connector/revision.rb