Skip to content

Instantly share code, notes, and snippets.

@llxff
Created August 15, 2013 07:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save llxff/6238925 to your computer and use it in GitHub Desktop.
Save llxff/6238925 to your computer and use it in GitHub Desktop.
Using devise + activeadmin with one User model and separate sign_in entry points
config.authentication_method = :authenticate_admin_user!
config.current_user_method = :current_admin_user
config.logout_link_path = :destroy_user_session_path
class AdminUser < User
self.inheritance_column = :_type_disabled
end
def authenticate_admin_user!
if current_admin_user.present? and current_user.blank?
sign_in current_admin_user, bypass: true
end
super
end
devise_for :users
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
@bestwebua
Copy link

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment