Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def define_model_callbacks(*callbacks)
- options = callbacks.extract_options!
- options = {
- :terminator => "result == false",
- :scope => [:kind, :name],
- :only => [:before, :around, :after]
- }.merge(options)
- types = Array.wrap(options.delete(:only))
- callbacks.each do |callback|
- define_callbacks(callback, options)
- types.each do |type|
- send("_define_#{type}_model_callback", self, callback)
- end
- end
- end
Add Comment
Please, Sign In to add comment