Problem with login form in sidebar


I have a basic login form rendered as a component in the sidebar of my
main layout view.

Whether or not the login succeeds, the controller redirects to the main
index to refresh the sidebar. On success, I set the session[:user_id]
to as usual.

The problem is that ‘index’ gets rendered in the sidebar. However, when
I comment out “session[:user_id] =”, redirect_to properly
refreshes ‘index’.

Has anyone had this problem or have a solution for doing sidebar logins?
Why would sessions affect redirect_to?


(As an aside, I previously attempted to implement this sidebar/login
form using AJAX, but failed. The session was getting deleted after the
redirect call in Javascript (window.location.href)…but that’s another