简体   繁体   中英

Ruby on Rails: Devise Users

What can I do to find out if a user is logged in?

Not only the current user, but all the users who are currently signed in.

Would I have to create my own function or is there an existing rails function that can take care of this?

You could use the devise_lastseenable gem, which would track a timestamp of when the user was last active. Then you would write a scope to find all of them within X minutes of the current time.

Another option would be to track a similar timestamp through sessions, but I'd give this gem a try first.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM