Created
June 6, 2016 19:54
-
-
Save amar47shah/3fcd4dc8b63494640dc86b4b28bf364a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# View | |
model = MY_MODEL_NAME | |
model.methods.select { |method| method.to_s =~ /^_{1}[^_].+_callbacks$/ } | |
.each_with_object({}) { |method, memo| memo[method] = model.send(method).group_by(&:kind) | |
.each { |_, callbacks| callbacks.map! { |callback| callback.raw_filter } } } | |
# Nuke | |
%i(initialize validate create update save destroy validation find touch commit rollback).each do |event| | |
reset_callbacks event | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment