Created
August 15, 2013 07:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.authentication_method = :authenticate_admin_user! | |
config.current_user_method = :current_admin_user | |
config.logout_link_path = :destroy_user_session_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AdminUser < User | |
self.inheritance_column = :_type_disabled | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authenticate_admin_user! | |
if current_admin_user.present? and current_user.blank? | |
sign_in current_admin_user, bypass: true | |
end | |
super | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devise_for :users | |
devise_for :admin_users, ActiveAdmin::Devise.config | |
ActiveAdmin.routes(self) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!!!