base_controller.rb 587 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. module Admin
  3. class BaseController < ApplicationController
  4. include Authorization
  5. include AccountableConcern
  6. layout 'admin'
  7. before_action :set_body_classes
  8. before_action :set_cache_headers
  9. after_action :verify_authorized
  10. private
  11. def set_body_classes
  12. @body_classes = 'admin'
  13. end
  14. def set_cache_headers
  15. response.cache_control.replace(private: true, no_store: true)
  16. end
  17. def set_user
  18. @user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
  19. end
  20. end
  21. end