class ActiveAdmin::BaseController

BaseController for ActiveAdmin. It implements ActiveAdmin controllers core features.

Constants

ACTIVE_ADMIN_ACTIONS

Attributes

active_admin_config[RW]

Reference to the Resource object which initialized this controller

Public Instance Methods

only_render_implemented_actions() click to toggle source

By default Rails will render un-implemented actions when the view exists. Because Active Admin allows you to not render any of the actions by using the actions method, we need to check if they are implemented.

# File lib/active_admin/base_controller.rb, line 28
def only_render_implemented_actions
  raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])
end

Private Instance Methods

active_admin_config() click to toggle source
# File lib/active_admin/base_controller.rb, line 52
def active_admin_config
  self.class.active_admin_config
end
active_admin_namespace() click to toggle source
# File lib/active_admin/base_controller.rb, line 57
def active_admin_namespace
  active_admin_config.namespace
end
active_admin_root() click to toggle source
# File lib/active_admin/base_controller.rb, line 75
def active_admin_root
  controller, action = active_admin_namespace.root_to.split '#'
  {controller: controller, action: action}
end
authenticate_active_admin_user() click to toggle source

Calls the authentication method as defined in ActiveAdmin.authentication_method

# File lib/active_admin/base_controller.rb, line 38
def authenticate_active_admin_user
  send(active_admin_namespace.authentication_method) if active_admin_namespace.authentication_method
end
current_active_admin_user() click to toggle source
# File lib/active_admin/base_controller.rb, line 42
def current_active_admin_user
  send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method
end
current_active_admin_user?() click to toggle source
# File lib/active_admin/base_controller.rb, line 47
def current_active_admin_user?
  !!current_active_admin_user
end
determine_active_admin_layout() click to toggle source

Determine which layout to use.

1.  If we're rendering a standard Active Admin action, we want layout(false)
    because these actions are subclasses of the Base page (which implements
    all the required layout code)
2.  If we're rendering a custom action, we'll use the active_admin layout so
    that users can render any template inside Active Admin.
# File lib/active_admin/base_controller.rb, line 71
def determine_active_admin_layout
  ACTIVE_ADMIN_ACTIONS.include?(params[:action].to_sym) ? false : 'active_admin'
end