diff options
author | wycats <wycats@gmail.com> | 2010-05-09 02:06:05 +0300 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-05-09 02:37:52 +0300 |
commit | d916c62cfc7c59ab6411407a05b946d3dd7535e9 (patch) | |
tree | 653ac4017ea6af4520dd9e6f60d846e19d5e3074 /activerecord/lib/active_record/callbacks.rb | |
parent | 636ffa1f089a51c98fce616191846eaba93d7b87 (diff) | |
download | rails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.tar.gz rails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.tar.bz2 rails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.zip |
eliminate alias_method_chain from ActiveRecord
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 7ebeb6079e..498836aca4 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -233,10 +233,6 @@ module ActiveRecord ] included do - [:create_or_update, :valid?, :create, :update, :destroy].each do |method| - alias_method_chain method, :callbacks - end - extend ActiveModel::Callbacks define_callbacks :validation, :terminator => "result == false", :scope => [:kind, :name] @@ -273,45 +269,33 @@ module ActiveRecord end end - def create_or_update_with_callbacks #:nodoc: - _run_save_callbacks do - create_or_update_without_callbacks - end + def valid?(*) #:nodoc: + @_on_validate = new_record? ? :create : :update + _run_validation_callbacks { super } end - private :create_or_update_with_callbacks - def create_with_callbacks #:nodoc: - _run_create_callbacks do - create_without_callbacks - end + def destroy #:nodoc: + _run_destroy_callbacks { super } end - private :create_with_callbacks - def update_with_callbacks(*args) #:nodoc: - _run_update_callbacks do - update_without_callbacks(*args) + def deprecated_callback_method(symbol) #:nodoc: + if respond_to?(symbol, true) + ActiveSupport::Deprecation.warn("Overwriting #{symbol} in your models has been deprecated, please use Base##{symbol} :method_name instead") + send(symbol) end end - private :update_with_callbacks - def valid_with_callbacks? #:nodoc: - @_on_validate = new_record? ? :create : :update - _run_validation_callbacks do - valid_without_callbacks? - end + private + def create_or_update #:nodoc: + _run_save_callbacks { super } end - def destroy_with_callbacks #:nodoc: - _run_destroy_callbacks do - destroy_without_callbacks - end + def create #:nodoc: + _run_create_callbacks { super } end - def deprecated_callback_method(symbol) #:nodoc: - if respond_to?(symbol, true) - ActiveSupport::Deprecation.warn("Overwriting #{symbol} in your models has been deprecated, please use Base##{symbol} :method_name instead") - send(symbol) - end + def update(*) #:nodoc: + _run_update_callbacks { super } end end end |