Kind of confused about why this happened.
Initially, my "players" table had a column named "password". While
learning about hashing, I had a model similar to the above, except the
before_create looked like this:
self.password = Player.hashed_password(self.password)
When I saved a player, I always got null in the password in the
But, if I set the hashed_password into some other attribute
(self.last_name, let's say), I ended up with a hash value in the
So all I did was to drop and create the table with the column called
"hashed_password" instead, and updated the model as attached, and off I
I don't understand why the 'password' column kept getting nulled
initially, though. I expected it would act like java; a reference to
the password attribute (string) would be passed into the hashed_password
method, which would return a reference to a new string, which I would
happen to assign to the hashed_password attribute.
Can anyone shed a little light on what's under the covers? Just a
curiousity question, it's all good after the rename.