Module: Approval::ActsAsUser

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/approval/acts_as_user.rb

Instance Method Summary collapse

Instance Method Details

#approve_request(request, reason:, execute: true) ⇒ Object


30
31
32
33
34
35
36
# File 'app/models/concerns/approval/acts_as_user.rb', line 30

def approve_request(request, reason:, execute: true)
  if execute
    Approval::RespondForm::ApproveWithExecute.new(user: self, reason: reason, request: request)
  else
    Approval::RespondForm::Approve.new(user: self, reason: reason, request: request)
  end
end

#cancel_request(request, reason:) ⇒ Object


26
27
28
# File 'app/models/concerns/approval/acts_as_user.rb', line 26

def cancel_request(request, reason:)
  Approval::RespondForm::Cancel.new(user: self, reason: reason, request: request)
end

#execute_request(request, reason: nil) ⇒ Object


42
43
44
# File 'app/models/concerns/approval/acts_as_user.rb', line 42

def execute_request(request, reason: nil)
  Approval::ExecuteForm.new(user: self, reason: reason, request: request)
end

#reject_request(request, reason:) ⇒ Object


38
39
40
# File 'app/models/concerns/approval/acts_as_user.rb', line 38

def reject_request(request, reason:)
  Approval::RespondForm::Reject.new(user: self, reason: reason, request: request)
end

#request_for_create(records, reason:) ⇒ Object


10
11
12
# File 'app/models/concerns/approval/acts_as_user.rb', line 10

def request_for_create(records, reason:)
  Approval::RequestForm::Create.new(user: self, reason: reason, records: records)
end

#request_for_destroy(records, reason:) ⇒ Object


18
19
20
# File 'app/models/concerns/approval/acts_as_user.rb', line 18

def request_for_destroy(records, reason:)
  Approval::RequestForm::Destroy.new(user: self, reason: reason, records: records)
end

#request_for_perform(records, reason:) ⇒ Object


22
23
24
# File 'app/models/concerns/approval/acts_as_user.rb', line 22

def request_for_perform(records, reason:)
  Approval::RequestForm::Perform.new(user: self, reason: reason, records: records)
end

#request_for_update(records, reason:) ⇒ Object


14
15
16
# File 'app/models/concerns/approval/acts_as_user.rb', line 14

def request_for_update(records, reason:)
  Approval::RequestForm::Update.new(user: self, reason: reason, records: records)
end