Skip to content
(UNMAINTAINED) Do Not Want: Stops ActiveRecord from doing things you probably didn't want
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Do Not Want

Several methods in ActiveRecord skip validations, callbacks, or both. In my extremely humble but also extremely correct opinion, this is a bad idea.

Do Not Want kills those methods dead so you won't cut yourself on them.

To install:

gem install donotwant

Why Do It Do It

In my experience, even experienced Rails developers don't know which of these methods skip validations and callbacks. Quick: which of decrement, decrement!, and decrement_counter skip which? (Hint: they're all different.)

How Do It Do It

It define_methods them away.

But! It also keeps a handle to the original method around and calls to the unsafe methods are allowed from within gems. This keeps Rails from breaking, and allows existing jank to continue being janky while keeping your app as jank-free as possible.

The disabled instance methods are:


The disabled class methods are:


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.

Something went wrong with that request. Please try again.