I need to get a historial of users when login and logout from application. I use devise
for model user
in Frontend (I have a model adminUser
for ActiveAdmin
/ Devise
login in Backend)
How can I execute function where I save that information in other table?
Current routes.rb:
Rails.application.routes.draw do
devise_for :users
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
end
In devise I override the default controllers while using super to invoke a method of the same name in the parent, after that's run you can then execute whatever you want.
For example:
class Users::SessionsController < Devise::SessionsController
# POST /resource/sign_in
def create
super
# >> Do some stuff
end
# DELETE /resource/sign_out
def destroy
super
# >> Do some different stuff
end
end
I'm not 100% sure that's what you mean, but I hope it's helpful
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.