Sha256: 41b2e21776d15eb4748d7f002c47c72727edffe734d82df5a7c6a44b54c93fd2

Contents?: true

Size: 621 Bytes

Versions: 7

Compression:

Stored size: 621 Bytes

Contents

module Ddr
  module Models
    module HasWorkflow
      extend ActiveSupport::Concern

      PUBLISHED = Ddr::Workflow::WorkflowState::PUBLISHED
      UNPUBLISHED = nil

      def workflow_state
        Ddr::Workflow::WorkflowState.workflow_state_for_object(self)
      end

      def published?
        self.workflow_state == PUBLISHED
      end
      
      def publish!
        Ddr::Workflow::WorkflowState.set_for_object(self, PUBLISHED)
        update_index
      end
      
      def unpublish!
        Ddr::Workflow::WorkflowState.set_for_object(self, UNPUBLISHED)
        update_index
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-models-1.7.0 lib/ddr/models/has_workflow.rb
ddr-models-1.6.0 lib/ddr/models/has_workflow.rb
ddr-models-1.5.0 lib/ddr/models/has_workflow.rb
ddr-models-1.4.0 lib/ddr/models/has_workflow.rb
ddr-models-1.3.0 lib/ddr/models/has_workflow.rb
ddr-models-1.2.1 lib/ddr/models/has_workflow.rb
ddr-models-1.2.0 lib/ddr/models/has_workflow.rb