Colin Law wrote in post #1155762:
Okie. This is what I see from how its happening:
1. There is a login page
2. When login page is loaded I see an entry for a session put in.
+-----+----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+
| id | session_id | data
| created_at | updated_at |
+-----+----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+
| 172 | 683aeb1fec89147c16db6ffb8614d915 |
BAh7BiIQX2NzcmZfdG9rZW4iMUVNN1ZVSSt6cGdMaTdRT1RycjhuVTlkWHMr
M1RyYzZyZUpYaEh5eE93VDQ9
3. When someone logs in successfully, I set the user_id value in the
session variable. Right then I see that the sql record has the value in
"data" variable changed.
session[:user_id] = params[:email]
4. When someone logs out, I clear the value and call reset_session.
Again I see the sql record has the "data" variable with changed value.
session[:user_id] = nil
reset_session
Hence the problem is:
1. Can't I ensure a session record is created only when I want - After
the user logs in ?
2. If not, Can I differentiate a authenticated session vs
unauthenticated sessions (sessions where the login page was just loaded
OR sessions where the user logged out) ?