Sha256: 86fedc6c87108afaae427994234a98152d7e58f18389eb4b9b56e2bb2d5873d3

Contents?: true

Size: 984 Bytes

Versions: 10

Compression:

Stored size: 984 Bytes

Contents

module RailsWorkflow
  class Operation < ActiveRecord::Base
    include OperationStatus

    include Operations::DefaultRunner
    include Operations::Dependencies
    include Operations::Assignments

    belongs_to :process, class_name: "RailsWorkflow::Process"
    belongs_to :template, class_name: "RailsWorkflow::OperationTemplate"
    belongs_to :child_process, class_name: "RailsWorkflow::Process"
    has_one :context, class_name: "RailsWorkflow::Context", as: :parent
    has_many :workflow_errors, class_name: "RailsWorkflow::Error", as: :parent

    delegate :data, to: :context
    delegate :role, to: :template
    delegate :group, to: :template

    scope :with_child_process, -> { where.not(child_process: nil) }
    scope :incompleted, -> { where(status: user_ready_statuses) }

    def instruction
      self.template.instruction
    end

    def manager
      @manager ||= process.manager
    end

    def manager= manager
      @manager = manager
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails_workflow-0.3.7 app/models/rails_workflow/operation.rb
rails_workflow-0.3.6 app/models/rails_workflow/operation.rb
rails_workflow-0.3.5 app/models/rails_workflow/operation.rb
rails_workflow-0.3.4 app/models/rails_workflow/operation.rb
rails_workflow-0.3.3 app/models/rails_workflow/operation.rb
rails_workflow-0.3.2 app/models/rails_workflow/operation.rb
rails_workflow-0.3.1 app/models/rails_workflow/operation.rb
rails_workflow-0.3.0 app/models/rails_workflow/operation.rb
rails_workflow-0.2.2 app/models/rails_workflow/operation.rb
rails_workflow-0.2.1 app/models/rails_workflow/operation.rb