Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `authenticate_admin_user!' when access activeadmin

I cannot get into admin panel after updating my activeadmin, my admin users are store in a table called admin_users.

      NoMethodError in Admin::DashboardController#index

      undefined method `authenticate_admin_user!' for #Admin::DashboardController:0x007fe46c3d99d0
      Rails.root: /Users/jianbo/Documents/Aptana Studio 3 Workspace/iv

      Application Trace | Framework Trace | Full Trace
      activeadmin (0.6.2) lib/active_admin/base_controller.rb:40:in authenticate_active_admin_user'
      activesupport (3.2.15) lib/active_support/callbacks.rb:474:inblock in run_3994836635519503653__process_action__2211030722258422070__callbacks'
      activesupport (3.2.15) lib/active_support/callbacks.rb:215:in `block in conditionalcallback_around_863'
like image 635
user1883793 Avatar asked Aug 05 '26 10:08

user1883793


1 Answers

As part of ActiveAdmin configuration you need to define a method on ApplicationController that requires authentication and determines whether the user is an admin (and hence can access ActiveAdmin pages). The name of this method can be controlled by this setting in the ActiveAdmin initializers:

config.authentication_method = :authenticate_admin_user!

The default name for this method is authenticate_admin_user!

If you already have a method that authenticates a user and confirms that they are an admin, just update the config to use that method. Otherwise you'll need to create this method on the ApplicationController

like image 118
Peter Goldstein Avatar answered Aug 07 '26 04:08

Peter Goldstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!