aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/callbacks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/callbacks.rb')
-rw-r--r--activemodel/lib/active_model/callbacks.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb
index b8ba1a0a52..e669113001 100644
--- a/activemodel/lib/active_model/callbacks.rb
+++ b/activemodel/lib/active_model/callbacks.rb
@@ -46,7 +46,7 @@ module ActiveModel
# Would only create the +after_create+ and +before_create+ callback methods in
# your class.
module Callbacks
- def self.extended(base)
+ def self.extended(base) #:nodoc:
base.class_eval do
include ActiveSupport::Callbacks
end
@@ -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)