lib/active_admin/base_controller.rb in activeadmin-1.0.0.pre2 vs lib/active_admin/base_controller.rb in activeadmin-1.0.0.pre3
- old
+ new
@@ -8,12 +8,17 @@
helper ::ActiveAdmin::ViewHelpers
helper_method :env
layout :determine_active_admin_layout
- before_filter :only_render_implemented_actions
- before_filter :authenticate_active_admin_user
+ if ActiveAdmin::Dependency.rails >= 4
+ before_action :only_render_implemented_actions
+ before_action :authenticate_active_admin_user
+ else
+ before_filter :only_render_implemented_actions
+ before_filter :authenticate_active_admin_user
+ end
class << self
# Ensure that this method is available for the DSL
public :actions
@@ -69,9 +74,14 @@
# 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.
def determine_active_admin_layout
ACTIVE_ADMIN_ACTIONS.include?(params[:action].to_sym) ? false : 'active_admin'
+ end
+
+ def active_admin_root
+ controller, action = active_admin_namespace.root_to.split '#'
+ {controller: controller, action: action}
end
end
end