Class: Approval::ExecuteForm
- Inherits:
-
Object
- Object
- Approval::ExecuteForm
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/approval/execute_form.rb
Instance Attribute Summary collapse
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#request ⇒ Object
Returns the value of attribute request.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user:, reason:, request:) ⇒ ExecuteForm
constructor
A new instance of ExecuteForm.
- #save ⇒ Object
- #save! ⇒ Object
Constructor Details
#initialize(user:, reason:, request:) ⇒ ExecuteForm
Returns a new instance of ExecuteForm.
7 8 9 10 11 |
# File 'app/models/approval/execute_form.rb', line 7 def initialize(user:, reason:, request:) @user = user @reason = reason @request = request end |
Instance Attribute Details
#reason ⇒ Object
Returns the value of attribute reason.
5 6 7 |
# File 'app/models/approval/execute_form.rb', line 5 def reason @reason end |
#request ⇒ Object
Returns the value of attribute request.
5 6 7 |
# File 'app/models/approval/execute_form.rb', line 5 def request @request end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'app/models/approval/execute_form.rb', line 5 def user @user end |
Instance Method Details
#save ⇒ Object
20 21 22 23 24 |
# File 'app/models/approval/execute_form.rb', line 20 def save return false unless valid? execute(&:save) end |
#save! ⇒ Object
26 27 28 29 30 |
# File 'app/models/approval/execute_form.rb', line 26 def save! raise ::ActiveRecord::RecordInvalid unless valid? execute(&:save!) end |