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. Becuase 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 29 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 53 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 58 def active_admin_namespace active_admin_config.namespace 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 39 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 43 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 48 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 73 def determine_active_admin_layout ACTIVE_ADMIN_ACTIONS.include?(params[:action].to_sym) ? false : 'active_admin' end