Class: ApprovalsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApprovalsController
- Defined in:
- lib/generators/approval_engine/views/templates/approvals_controller.rb
Overview
Copied by ‘rails generate approval_engine:views`.
This file is yours now — restyle it, rename it, add authorization (Pundit, etc.). ApprovalEngine provides the mechanism (step.approve! / reject!); the user-facing experience is entirely up to you.
Instance Method Summary collapse
Instance Method Details
#approve ⇒ Object
15 16 17 |
# File 'lib/generators/approval_engine/views/templates/approvals_controller.rb', line 15 def approve act(:approve!, notice: "Approval recorded.") end |
#index ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/generators/approval_engine/views/templates/approvals_controller.rb', line 7 def index # actionable_by includes steps delegated to you, and preloads each step's # target so the view can show *what* is awaiting approval without N+1s. @pending_steps = ApprovalEngine::Step.actionable_by(current_user) .includes(track: { approval: :target }) .order(:created_at) end |
#reject ⇒ Object
19 20 21 |
# File 'lib/generators/approval_engine/views/templates/approvals_controller.rb', line 19 def reject act(:reject!, notice: "Rejection recorded.") end |