diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index 80385c2614..e669113001 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -89,11 +89,11 @@ module ActiveModel def define_model_callbacks(*callbacks) options = callbacks.extract_options! options = { - :terminator => "result == false", - :skip_after_callbacks_if_terminated => true, - :scope => [:kind, :name], - :only => [:before, :around, :after] - }.merge(options) + :terminator => "result == false", + :skip_after_callbacks_if_terminated => true, + :scope => [:kind, :name], + :only => [:before, :around, :after] + }.merge!(options) types = Array(options.delete(:only)) @@ -106,6 +106,8 @@ module ActiveModel end end + private + def _define_before_model_callback(klass, callback) #:nodoc: klass.class_eval <<-CALLBACK, __FILE__, __LINE__ + 1 def self.before_#{callback}(*args, &block)