Class: Approval::ExecuteForm
- Inherits:
-
Object
- Object
- Approval::ExecuteForm
- Includes:
- ActiveModel::Model, FormNotifiable
- 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.
8 9 10 11 12 |
# File 'app/models/approval/execute_form.rb', line 8 def initialize(user:, reason:, request:) @user = user @reason = reason @request = request end |
Instance Attribute Details
#reason ⇒ Object
Returns the value of attribute reason.
6 7 8 |
# File 'app/models/approval/execute_form.rb', line 6 def reason @reason end |
#request ⇒ Object
Returns the value of attribute request.
6 7 8 |
# File 'app/models/approval/execute_form.rb', line 6 def request @request end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'app/models/approval/execute_form.rb', line 6 def user @user end |
Instance Method Details
#save ⇒ Object
21 22 23 24 25 |
# File 'app/models/approval/execute_form.rb', line 21 def save return false unless valid? execute(&:save) end |
#save! ⇒ Object
27 28 29 30 31 |
# File 'app/models/approval/execute_form.rb', line 27 def save! raise ::ActiveRecord::RecordInvalid unless valid? execute(&:save!) end |