A couple bugs, with fixes

Mar 19, 2010 • posted by Michael Hartl

I've fixed a couple of bugs in the recently released Sign in, sign out chapter. Any readers who have already worked the chapter should update their code using the latest version. (Be sure to reload your browser and clear your browser cache to make sure you have the freshest release.)

First, Listing 8.19 has been updated to prevent users with nil remember tokens from being automatically signed in. Second, and more seriously, Listing 8.14 has been updated to allow users to sign in, sign out, and then sign in again. As originally written, users could only sign in once, which probably counts as a serious bug. :-) If you've already run into this issue, you should reset the affected user's password using the console:

$ script/console>> user = User.first # or whichever one it is>> user.update_attributes(:password => "foobar", :password_confirmation => "foobar")

Then restart your development server.

Thanks to the several readers who have already caught issues in this chapter, and especially to batkins for catching the multiple-sign-in bug.