Update_attribute - effecting multiple attributes

Anybody know why this:

User.find(current_user).update_attribute(:last_subject,
params[:subject_id])

results in this:

AREL (0.6ms) UPDATE “users” SET “last_subject” = 4,
“encrypted_password” =
‘f470e6e76203973146c3b07e8b31c976b19cb23a9bf37485ad1911687cdc7a29’,
“updated_at” = ‘2011-10-12 13:43:21.727558’ WHERE “users”.“id” = 9

For some reason it is updating more than just the :last_subject. Its
also changing the user password and the user can no longer log in again.

Thanks,

DC

What does your User class look like? You might have something else in
there
that’s firing before save.

Tim S. wrote in post #1026306:

What does your User class look like? You might have something else in
there
that’s firing before save.

Thanks! That was it…

DC

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs