Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
record login time
4 Posts
record login time

thanks. your suggestions really worked.

I guess that your are talking about the session hash when you write 'session table', isn't it?

What are you using to authenticate your users, I usually install 'restfull_authentication', the way that you will to save the user login time is relative to the plugin that you were using.

To be more general II think that you could save in a session variable the datetime when the user enter to the system doing something like:

def login

 session[:user_log_time] = DateTime.now


and then calculate the time that the user was logged with:

On the login action you can do session[:logged_at] = Time.now.to_s and then you can check it with session[:logged_at]

how to retrieve values from session table? how to save user's login time? gives all info but i have to show only user's login time.

4 Posts
Login to add your message