Class: Pgbus::LocksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Pgbus::LocksController
- Defined in:
- app/controllers/pgbus/locks_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#discard ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/pgbus/locks_controller.rb', line 9 def discard count = data_source.discard_lock(params[:id]) if count.positive? redirect_to locks_path, notice: t("pgbus.locks.index.lock_discarded") else redirect_to locks_path, alert: t("pgbus.locks.index.lock_discard_failed") end end |
#discard_all ⇒ Object
29 30 31 32 |
# File 'app/controllers/pgbus/locks_controller.rb', line 29 def discard_all count = data_source.discard_all_locks redirect_to locks_path, notice: t("pgbus.locks.index.all_locks_discarded", count: count) end |
#discard_selected ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/pgbus/locks_controller.rb', line 18 def discard_selected keys = Array(params[:lock_keys]).reject(&:blank?) if keys.empty? redirect_to locks_path, alert: t("pgbus.locks.index.none_selected") return end count = data_source.discard_locks(keys) redirect_to locks_path, notice: t("pgbus.locks.index.locks_discarded", count: count) end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/pgbus/locks_controller.rb', line 5 def index @locks = data_source.job_locks end |