When an object returns false for .valid? , is there a way to find out why?
CardSignup.new(params[:card_signup]).valid?
=> false
Sounds great Rails..but why?
Sort of related, but here’s an example. I’m doing this :
@card_signup.update_attributes("email"=>"asdfa@asfa.com")
=> false
But if I do this :
@card_signup.update_attribute("email", "asdfa@asfa.com")
=> true
Why would that work when I update the single attribute as opposed to update_attributes?
You should check the
@card_signup.errorscollection.For your second question, the
update_attributemethod saves the record without validation procedure. On the opposite,update_attributesperform validations.