Makes it possible to skip initial state setting

This commit is contained in:
Brusk Hamarash 2022-02-20 15:49:48 +03:00 committed by GitHub
parent 7fc0c61063
commit 0cd3e6957f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ module Workflower
end
module ClassMethods
def workflower(default_workflow_id:, source:, workflower_state_column_name: "workflow_state")
def workflower(default_workflow_id:, source:, workflower_state_column_name: "workflow_state", skip_setting_initial_state: false)
raise Workflower::WorkflowerError, "Options can't be blank" if source.blank? || default_workflow_id.blank?
cattr_accessor :source, default: source
@ -69,7 +69,7 @@ module Workflower
self.default_workflow_id = default_workflow_id
# self.validates "#{workflow_model.tableize.singularize}_id", presence: true
before_create :set_intial_state
before_create :set_intial_state unless skip_setting_initial_state
end
def workflower_abilities