Class: MassSearch::OutgoingPaymentApproveCheckWorker
- Inherits:
-
Object
- Object
- MassSearch::OutgoingPaymentApproveCheckWorker
- Includes:
- Workers::MassSearchWorker
- Defined in:
- app/workers/mass_search/outgoing_payment_approve_check_worker.rb
Overview
Approves each selected OutgoingPayment check.
Requires current user to have :approve_check permission on OutgoingPayment.
Instance Method Summary collapse
-
#build_enumerator(args, cursor:) ⇒ Object
Build enumerator.
-
#on_complete ⇒ Object
On complete.
Methods included from Workers::MassSearchWorker
Instance Method Details
#build_enumerator(args, cursor:) ⇒ Object
Build enumerator.
13 14 15 16 17 18 19 20 21 |
# File 'app/workers/mass_search/outgoing_payment_approve_check_worker.rb', line 13 def build_enumerator(args, cursor:) super unless @user&.account&.can?(:approve_check, OutgoingPayment) @unauthorised = true return active_record_records_enumerator(@search.search_results.none, cursor: cursor) end active_record_records_enumerator(@search.search_results, cursor: cursor) end |
#on_complete ⇒ Object
On complete.
26 27 28 29 30 31 32 33 34 |
# File 'app/workers/mass_search/outgoing_payment_approve_check_worker.rb', line 26 def on_complete if @unauthorised store error_message: "You don't have permission to approve checks.", redirect_to: UrlHelper.instance.accounts_payable_dashboard_path return end super end |