Ruby on Rails Monday, August 4, 2014

Hi,
I have been asking this question in multiple forums like stackexchange
but have not received a solution or proper help. Any help here is
appreciated.

I have a rails app with a session store database (mysql). When I want to
clear a session, I reset the session variables and call reset_session.
But then the record in mysql which was added on creating a session does
not get cleared automatically (which it should).

This is how my sessions controller looks like:


class SessionsController < ApplicationController
def create
session[:user_id] = params[:email]
session[:username] = params[:email]
end

def destroy
session[:user_id] = nil
session[:username] = nil
reset_session
end

When the create gets called, I see rails adding a record automatically
in the sessions table. But then it does not get cleaned up on
reset_session.

kybitz-vm_001:(controllers) [master]$ rails -v
Rails 3.2.13
kybitz-vm_001:(controllers) [master]$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

Thanks.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0fba70d6d0892787394c34d0afd68d68%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment