diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-30 11:43:34 +0100 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2009-12-30 13:40:37 -0800 |
commit | cb3c0d490b7e8ac867068ccec6bbeb09a6a04b7d (patch) | |
tree | 5cdb0262dcea0e52b800434179e6307878c8399a /activerecord | |
parent | a6e2d16b1ef1fbde28325f0e0e2b8855d6a7606c (diff) | |
download | rails-cb3c0d490b7e8ac867068ccec6bbeb09a6a04b7d.tar.gz rails-cb3c0d490b7e8ac867068ccec6bbeb09a6a04b7d.tar.bz2 rails-cb3c0d490b7e8ac867068ccec6bbeb09a6a04b7d.zip |
Get rid of DeprecatedCallbacks in ActiveRecord::Associations and finally remove it.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations.rb | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index b2b3a9789c..1ceb0dbf96 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -485,7 +485,14 @@ module ActiveRecord def callback(method, record) callbacks_for(method).each do |callback| - ActiveSupport::DeprecatedCallbacks::Callback.new(method, callback, record).call(@owner, record) + case callback + when Symbol + @owner.send(callback, record) + when Proc + callback.call(@owner, record) + else + callback.send(method, @owner, record) + end end end diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index e1d772bd95..e2a8f03c8f 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -274,7 +274,7 @@ module ActiveRecord def deprecated_callback_method(symbol) #:nodoc: if respond_to?(symbol) - ActiveSupport::Deprecation.warn("Base##{symbol} has been deprecated, please use Base.#{symbol} :method instead") + ActiveSupport::Deprecation.warn("Overwriting #{symbol} in your models has been deprecated, please use Base##{symbol} :method_name instead") send(symbol) end end diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index e8a2a72735..12c1f23763 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -17,8 +17,6 @@ module ActiveRecord module Validations extend ActiveSupport::Concern - - include ActiveSupport::DeprecatedCallbacks include ActiveModel::Validations included do |