ActiveRecord Callbacks List

You can call Model._save_callbacks to get a list of all callbacks on save.
You can then filter it down to what kind you need e.g. :before or :after like this:

Model._save_callbacks.select {|cb| cb.kind == :before}

Works the same for Model._destroy_callbacks etc.

Leave a Comment