update_attribute - effecting multiple attributes

6 views
Skip to first unread message

Dave Castellano

unread,
Oct 12, 2011, 12:51:22 PM10/12/11
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Tim Shaffer

unread,
Oct 12, 2011, 1:08:47 PM10/12/11
to rubyonra...@googlegroups.com
What does your User class look like? You might have something else in there that's firing before save.

Dave Castellano

unread,
Oct 12, 2011, 1:33:02 PM10/12/11
to rubyonra...@googlegroups.com
Tim Shaffer 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...

Reply all
Reply to author
Forward
0 new messages