Module: Submission::StateMachine

Included in:
Submission
Defined in:
app/models/submission/state_machine.rb

Overview

Included in submission to add its state-machine

Uses the following states: building - Initial state. Indicates the user is preparing the submissions pending - The submission has been finalized by the user and is awaiting processing.

Entry into this state queues the submission for processing by the {SubmissionBuilderJob}

processing - The delayed job has picked up the submission and is currently building it ready - The submission has been processed and is ready for work failed - The SubmissionBuilderJob failed and the submission has not been processed cancelled - The submission was made in error or is no longer needed. Entry into this

state will cancel all requests in the submission.

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

UnprocessedStates =
%w[building pending processing]

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/submission/state_machine.rb', line 17

def self.extended(base)
  base.class_eval do
    include AASM
    include InstanceMethods

    configure_state_machine
    configure_named_scopes

    def editable?
      state == 'building'
    end
  end
end