Chatwoot/app/controllers/super_admin/application_controller.rb
2020-05-24 22:44:26 +05:30

23 lines
847 B
Ruby

# All Administrate controllers inherit from this
# `Administrate::ApplicationController`, making it the ideal place to put
# authentication logic or other before_actions.
#
# If you want to add pagination or other controller-level concerns,
# you're free to overwrite the RESTful controller actions.
class SuperAdmin::ApplicationController < Administrate::ApplicationController
# authenticiation done via devise : SuperAdmin Model
before_action :authenticate_super_admin!
# Override this value to specify the number of elements to display at a time
# on index pages. Defaults to 20.
# def records_per_page
# params[:per_page] || 20
# end
def order
@order ||= Administrate::Order.new(
params.fetch(resource_name, {}).fetch(:order, 'id'),
params.fetch(resource_name, {}).fetch(:direction, 'desc')
)
end
end