Ruby on Rails Tuesday, July 24, 2012

Hi,

I need to create an app where one user cannot login using multiple browsers. As soon as he does, the previous one logs out.

I have a user table with a field named "current_sign_in_token' to store the session key generated by one login.
But I am not able to retrieve the session key. Actually I don't know exactly how to do it. Have been following several posts but in vain.

Following is my initializers/session_store.rb file

Contactapp::Application.config.session_store :cookie_store,{ :key => '_contactapp_session',
 :secret => '[kjhafdhbcrekjbwrewhbvwbvlwruhfwlkevjnwlghbwljtvhblwevblswetbvlwrnvjnsklejvni45uhvgiwlu758t75fblwbcw...]',
 :expire_after => 5.minutes}

I am trying to retrieve request.session_options[:id] in my controller but it doesn't returns any value. But it does returns values when I use it in a view.
 
The value Rails.application.config.session_options[:key] doesn't seems to satisfy what I need to do as it just returns the values '_contactapp_session'.

What shall I do next. Am stuck.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/dwxLGeX04ooJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment