Sunday, May 19, 2013

[Rails] Re: update_attributes() for a single column

On May 19, 1:37 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> That is indeed weird - the only validation I've ever used in conjunction with the confirmation field is validates_confirmation_of.  You can check user.errors to see all the errors rails thinks the object has.
>

Thanks, it was indeed missing password + confirmation causing the
ROLLBACK.

irb(main):004:0> user.errors
=> #<ActiveModel::Errors:0x29fe1b30 @base=#<User id: 1, name: "Example
User", email: "exampl@railstutorial.org", created_at: "2013-05-12
12:47:23", updated_at: "2013-05-19 07:55:25", password_digest: "$2a
$10$0i9ihaDD9nU6QxiGNiKEGeIarY9faPWY9lAAlLIzYz8U...">,
@messages={:password_confirmation=>["can't be blank"], :password=>["is
too short (minimum is 6 characters)"]}>

has_secure_password must be something new in Rails 4. It does
everything validates_confirmation_of does.
And attr_accessible also seems to have become a thing from the past.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate