action_logs_controller.rb 594 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. module Admin
  3. class ActionLogsController < BaseController
  4. before_action :set_action_logs
  5. def index
  6. authorize :audit_log, :index?
  7. @auditable_accounts = Account.where(id: Admin::ActionLog.reorder(nil).select('distinct account_id')).select(:id, :username)
  8. end
  9. private
  10. def set_action_logs
  11. @action_logs = Admin::ActionLogFilter.new(filter_params).results.page(params[:page])
  12. end
  13. def filter_params
  14. params.slice(:page, *Admin::ActionLogFilter::KEYS).permit(:page, *Admin::ActionLogFilter::KEYS)
  15. end
  16. end
  17. end