Sha256: 59baeec5012b7316750ea3f25855997e5b35d5d9b3c02eb3e6d8aaee4cb53a30
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
module RailsConnector class Workspace extend ActiveModel::Naming include Kvom::ModelIdentity def self.current=(workspace_or_proc) @current = workspace_or_proc end def self.current if @current.respond_to? :call @current = @current.call else @current || default end end def self.default find("published") end def self.find(id) if workspace_data = CmsBackend.find_workspace_data_by_id(id) Workspace.new workspace_data else raise ResourceNotFound, "Could not find #{self} with id #{id}" end end def initialize(workspace_data) @workspace_data = workspace_data end def id @workspace_data.id end def revision_id @workspace_data.revision_id end def data @workspace_data end # only available with direct access to dynamo def revision @workspace_data.revision end # only available with direct access to dynamo def content_cache_id=(id) @workspace_data.content_cache_id = id end def published? self.id == 'published' end end end
Version data entries
5 entries across 5 versions & 1 rubygems