aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-05-09 02:06:05 +0300
committerwycats <wycats@gmail.com>2010-05-09 02:37:52 +0300
commitd916c62cfc7c59ab6411407a05b946d3dd7535e9 (patch)
tree653ac4017ea6af4520dd9e6f60d846e19d5e3074 /activerecord/lib/active_record/associations.rb
parent636ffa1f089a51c98fce616191846eaba93d7b87 (diff)
downloadrails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.tar.gz
rails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.tar.bz2
rails-d916c62cfc7c59ab6411407a05b946d3dd7535e9.zip
eliminate alias_method_chain from ActiveRecord
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 6c64210c92..0a3c7c6a60 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1304,14 +1304,14 @@ module ActiveRecord
# Don't use a before_destroy callback since users' before_destroy
# callbacks will be executed after the association is wiped out.
- old_method = "destroy_without_habtm_shim_for_#{reflection.name}"
- class_eval <<-end_eval unless method_defined?(old_method)
- alias_method :#{old_method}, :destroy_without_callbacks # alias_method :destroy_without_habtm_shim_for_posts, :destroy_without_callbacks
- def destroy_without_callbacks # def destroy_without_callbacks
- #{reflection.name}.clear # posts.clear
- #{old_method} # destroy_without_habtm_shim_for_posts
- end # end
- end_eval
+ include Module.new {
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
+ def destroy # def destroy
+ super # super
+ #{reflection.name}.clear # posts.clear
+ end # end
+ RUBY
+ }
add_association_callbacks(reflection.name, options)
end