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