diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-25 13:12:49 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-25 13:21:26 -0300 |
commit | 2a7cfee13e5eb4021a6e5a6ec986f495e7e8f73f (patch) | |
tree | 1ab91296291a551f15caad6774ff6217c11ebc93 /activemodel/lib/active_model | |
parent | 24a4cc741a948cd4a01d172a3bfbd68c509b4448 (diff) | |
download | rails-2a7cfee13e5eb4021a6e5a6ec986f495e7e8f73f.tar.gz rails-2a7cfee13e5eb4021a6e5a6ec986f495e7e8f73f.tar.bz2 rails-2a7cfee13e5eb4021a6e5a6ec986f495e7e8f73f.zip |
Make internal callback model definitions private in AMo
These _define class methods don't need to be exposed to objects that
extend ActiveModel::Callbacks.
Also use merge! options to avoid the creation of an extra hash.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/callbacks.rb | 12 |
1 files changed, 7 insertions, 5 deletions
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) |