Forum: Ruby on Rails Problem with login form in sidebar

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
mofo m. (Guest)
on 2006-02-06 03:41
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 @user.id as usual.

The problem is that 'index' gets rendered in the sidebar.  However, when
I comment out "session[:user_id] = @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?

Thanks,
Boram


(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
story).
This topic is locked and can not be replied to.