Do Not Want
Several methods in ActiveRecord skip validations, callbacks, or both. In my extremely humble but also extremely correct opinion, it's too easy to accidentally use these.
Do Not Want kills those methods dead so you won't cut yourself on them:
>> User.new.update_attribute(:foo, 5) DoNotWant::NotSafe: User#update_attribute isn't safe because it skips validation
Why Do It Do It?
In my experience, even experienced Rails developers don't know which ActiveRecord methods skip validations and callbacks. Quick: which of
decrement_counter skip which? (Hint: they're all different.)
How Do It Do It?
define_methods them away.
But! Calls to the unsafe methods are allowed from within gems. This keeps Rails from breaking, and allows third-party code to do as it pleases while keeping your app as jank-free as possible.
The disabled instance methods are:
decrement decrement! increment ncrement! toggle toggle! update_attribute
The disabled class methods are:
decrement_counter delete delete_all find_by_sql increment_counter update_all update_counters
The particular transgressions that these methods make are documented in the source.
The Rails ActiveRecord guide contains lists about methods that skip validation and callbacks. That's where this list came from.