我需要在历史记录表中跟踪用户的设计连接。 只是一个带有user_id,login_time,logout_time的基本表。
你知道这项工作的宝石吗? (devise_traceable实际上是我想要的,但不再受支持,有一些错误,只有在用户注销时才添加登录时间。)
我没有宝石,你知道如何扩展设计吗?
谢谢!
答案 0 :(得分:0)
好的,我已经找到了如何使用Warden
在devise.rb中:
Warden::Manager.after_authentication do |user, auth, opts|
... create trace here ...
end
Warden::Manager.before_logout do |user, auth, opts|
... stop trace here ...
end