I have a Client
model setup with Devise, and I've namespaced the routes like this:
namespace :portal do
devise_for :clients, controllers: {
sessions: 'clients/sessions',
registrations: 'clients/registrations',
invitations: 'clients/invitations'
}
end
Because of this, instead of a current_client
helper I get current_portal_client
. Is there a way I can set it to current_client
? Should I just alias it in ApplicationController or is there a Devise specific way?
Devise builds those methods on the fly and adds them to ActiveSupport
on load. See line 132 here: https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/helpers.rb , so overriding the default functionality might be tricky and could get ugly fast.
Since Devise doesn't appear to offer any easily configurable overrides, you're probably better off writing an alias method in your ApplicationController
as you suggested.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.