You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2019. It is now read-only.
nathanl edited this page Jan 9, 2013
·
3 revisions
The Devise authentication gem allows you to have multiple types of users. For example, you might have current_user for some controllers and current_admin for others.
Authority currently only supports a single method for getting the current user; whatever you put in config.user_method, it will expect to be able to call that method on any controller in your app.
However, you can easily adapt to this requirement using method aliases. For example:
# config/initializers/authority.rbconfig.user_method=:user_for_this_request# or whatever; default is :current_user# app/controllers/users_controller.rbclassUsersController < ApplicationControlleralias:user_for_this_request:current_userend# app/controllers/admins_controller.rbclassAdminsController < ApplicationControlleralias:user_for_this_request:current_adminend# app/controllers/secret_things_controller.rbclassSecretThingsController < AdminsControllerend