Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
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.
On the login action you can do session[:logged_at] = Time.now.to_s and then you can check it with session[:logged_at]
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
...
end
and then calculate the time that the user was logged with:
thanks. your suggestions really worked.
