Class: Admin::RecordLocksController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Admin::RecordLocksController
- Defined in:
- lib/generators/open_loam/install/templates/admin/record_locks_controller.rb
Overview
Manager take-over of an advisory edit lock (OpenLoam::RecordLocks). Only a manager may force-release someone else's lock; the record it points at is resolved through a whitelist (a OpenLoam::TenantRecord subclass), never a raw constantize of user input.
Constant Summary
Constants included from Pagination
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from Pagination
Instance Method Details
#destroy ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/generators/open_loam/install/templates/admin/record_locks_controller.rb', line 9 def destroy klass = params[:lockable_type].to_s.safe_constantize raise OpenLoam::NotAuthorizedError unless klass && klass < OpenLoam::TenantRecord OpenLoam::RecordLocks.force_release(klass.find(params[:lockable_id])) redirect_back fallback_location: admin_root_path, notice: "Lock released — you can edit now." end |