Class: Approval::Request

Inherits:
ApplicationRecord show all
Defined in:
app/models/approval/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_user_associationObject


5
6
7
8
# File 'app/models/approval/request.rb', line 5

def self.define_user_association
  belongs_to :request_user, class_name: Approval.config.user_class_name
  belongs_to :respond_user, class_name: Approval.config.user_class_name, optional: true
end

Instance Method Details

#executeObject


31
32
33
34
35
# File 'app/models/approval/request.rb', line 31

def execute
  self.state = :executed
  self.executed_at = Time.current
  items.each(&:apply)
end