Class: Wf::CaseCommand::ReleaseToken
- Inherits:
-
Object
- Object
- Wf::CaseCommand::ReleaseToken
- Includes:
- SimpleCommand
- Defined in:
- app/models/wf/case_command/release_token.rb
Instance Attribute Summary collapse
-
#workitem ⇒ Object
readonly
Returns the value of attribute workitem.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(workitem) ⇒ ReleaseToken
constructor
A new instance of ReleaseToken.
Constructor Details
#initialize(workitem) ⇒ ReleaseToken
Returns a new instance of ReleaseToken.
7 8 9 |
# File 'app/models/wf/case_command/release_token.rb', line 7 def initialize(workitem) @workitem = workitem end |
Instance Attribute Details
#workitem ⇒ Object (readonly)
Returns the value of attribute workitem.
6 7 8 |
# File 'app/models/wf/case_command/release_token.rb', line 6 def workitem @workitem end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/wf/case_command/release_token.rb', line 11 def call Wf::ApplicationRecord.transaction do Wf::Token.where(locked_workitem_id: workitem.id).locked.each do |token| AddToken.call(token.case, token.place) token.update!(state: :canceled, canceled_at: Time.zone.now) end end end |