开发者

Rails v3 session destroy doesn't work?

I am obviously new to Rails, so I followed some examples on how to cleanup session on logout, but the session is n开发者_StackOverflowot being cleaned up. See code here, first logger statement prints "20" and the second logger statement also prints "20"

Is there anything else i need to do, some configuration may be?? I tried session.delete(:user_id) as well & it just wont work.

def destroy
  logger.error "Session user #{session[:user_id]}" #prints 20

  session[:user_id] = nil
  session.delete(:user_id)
  session.destroy

  logger.error "Session user #{session[:user_id]}" #prints 20 again??

  redirect_to :root
end

My environment -

  • Rails v3.0.3 Local Dev env (OSX)
  • Everything is default since its a dev environment
  • default session store, i haven't played around with that as yet


In place of session.destroy use

reset_session

This will reset all the sessions present in the application.

Thanks....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜