I always forget, but you might want to try EXPLICITLY "true" at the end (if session[:user] is FALSE). I mean just use return true as an else statement to the that session[:user] condition, or just put true at the very end just before this before filter closes.
2012/7/25 sumit srivastava <sumit.theinvinci...@gmail.com> > I store the request.session_options[:id] in my user table when one logs > in. If another user logs in using another browser, this value is updated. > For every action requested by user this value is checked by current value > of this variable. If not matched, user is redirected to login page. > Following is the code, > > def deny_multiple_login >> if(session[:user]) >> @session_old_key = (User.where("username =?", >> session[:user].username)).first.current_sign_in_token >> @session_current_key = request.session_options[:id] >> >> if(@session_current_key != @session_old_key) >> respond_to do |format| >> format.html {redirect_to logout_path} >> end >> end >> end >> end >> > This one is defined in ApplicationController. > > And then I user *before_filter :deny_multiple_login* in my * > ContactsController*. > Also I have another controller *Usercontroller *which is responsible for > login actions and contacts controller is responsible to manage contacts > list of every user. > > > > Regards > Sumit Srivastava > > The power of imagination makes us infinite... > > > On 25 July 2012 15:31, Gintautas Šimkus <dihita...@gmail.com> wrote: > >> "I added code for session management where one user can login only using >> one browser at a time" >> >> And what if the same user is doing a request from another browser? What >> actions do you take? It sounds reasonable to me to assume that your logic >> for determining if the browser detection logic is bugged. >> >> >> 2012/7/25 sumit srivastava <sumit.theinvinci...@gmail.com> >> >>> Peter, >>> >>> I added code for session management where one user can login only using >>> one browser at a time. Other than that I tried production mode of the app. >>> >>> >>> Regards >>> Sumit Srivastava >>> >>> The power of imagination makes us infinite... >>> >>> >>> On 25 July 2012 15:25, Peter Hicks <peter.hi...@poggs.co.uk> wrote: >>> >>>> >>>> On 25 Jul 2012, at 10:45, sumit srivastava wrote: >>>> >>>> > The same code was running fine earlier but now I am not able to get >>>> where it has got problem. >>>> >>>> What did you change between the last time it worked, and now? >>>> >>>> >>>> Peter >>>> >>>> -- >>>> 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+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> -- >>> 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+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> >> -- >> Pagarbiai, >> Gintautas >> >> -- >> 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+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Pagarbiai, Gintautas -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.