Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

8.7 Skipping Validations

The methods update_attribute and update_column don’t invoke validations, yet their companion method update does. Whoever wrote the related Rails API docs believes that this behavior is “especially useful for Boolean flags on existing records.”

I don’t know if that is entirely true or not, but I do know that it is the source of ongoing contention in the community. Unfortunately, I don’t have much more to add other than some simple commonsense advice: Be very careful using the update_attribute or update_column methods. It can easily persist your model objects in invalid states.

  • + Share This
  • 🔖 Save To Your Account