There is some bit of history here.

The purpose of update_attribute was to be able to touch an attribute fast,
set a flag for example... something you know can go straight to the
database. Indeed, update_attribute has *never* run validations.

There was some discussion about this method for Rails 3 because if the goal
was to bypass stuff to be fast it didn't felt consistent to still go
through the callbacks. And for some time update_attribute skipped also
callbacks in edge:


https://github.com/rails/rails/commit/01629d180468049d17a8be6900e27a4f0d2b18c4

though it still touched updated_at, so fast but not quite there.

That method is so popular, however, that the change felt too risky because
it was subtle, and that was reverted just before shipping:


https://github.com/rails/rails/commit/30ea923040ded944209c98383389b6c9aafe806a

In the end, in 3.1 it was decided to introduce instead a new method
update_column. That is the fast one.

Given the current status of things, I personally agree that running
validations in update_attribute in Rails 4 would be a good idea.

Let's see what other core team members think though. Thoughts?

-- 
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to