class ActiveAdmin::BaseController
It implements ActiveAdmin controllers core features.
BaseController for ActiveAdmin.
def active_admin_config
def active_admin_config self.class.active_admin_config end
def active_admin_namespace
def active_admin_namespace active_admin_config.namespace end
def active_admin_root
def active_admin_root controller, action = active_admin_namespace.root_to.split "#" { controller: controller, action: action } end
def authenticate_active_admin_user
def authenticate_active_admin_user send(active_admin_namespace.authentication_method) if active_admin_namespace.authentication_method end
def build_download_formats(download_links)
def build_download_formats(download_links) download_links = instance_exec(&download_links) if download_links.is_a?(Proc) if download_links.is_a?(Array) && !download_links.empty? download_links elsif download_links == false [] else DEFAULT_DOWNLOAD_FORMATS end end
def current_active_admin_user
def current_active_admin_user send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method end
def current_active_admin_user?
def current_active_admin_user? !!current_active_admin_user end
def default_page_presenter
def default_page_presenter PagePresenter.new end
def default_page_title
def default_page_title active_admin_config.name end
def only_render_implemented_actions
Admin allows you to not render any of the actions by using the #actions method, we need
By default Rails will render un-implemented actions when the view exists. Because Active
def only_render_implemented_actions raise AbstractController::ActionNotFound unless action_methods.include?(params[:action]) end
def page_presenter
def page_presenter active_admin_config.get_page_presenter(params[:action].to_sym) || default_page_presenter end
def page_title
def page_title if page_presenter[:title] helpers.render_or_call_method_or_proc_on(self, page_presenter[:title]) else default_page_title end end