On Mar 3, 11:29 am, "DHH" <[EMAIL PROTECTED]> wrote:
> > I was hoping someone could take the time to explain to me why
> > update_attribute doesn't trigger validations? Why am I concerned with this?
>
> Because it's intended to be used in scenarios where you're not
> interested in dealing with validation errors. Such as automatic
> functions that update a flag or increment a counter at billing. These
> functions should not fail just because the object is invalid for
> whatever reason.

I think things should be swapped around, the API should be designed
for the common case which is that you want validation. If you don't
want validation, then do

object.attribute = value
object.save(false)

Of course, this is ultimately a matter of taste and of priorities, but
I think in this case data integrity and the principle of least
surprise should be prioritized.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to