From 8777ae1f4ac42dd47c3455cf40c9cf59daad7ca9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 11 Jun 2013 10:33:16 -0700 Subject: reduce evals in depdendent associations --- activerecord/lib/active_record/associations/builder/association.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations/builder/association.rb') diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index 6a3658f328..5804cb7fed 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -117,7 +117,8 @@ module ActiveRecord::Associations::Builder end CODE - model.before_destroy "#{macro}_dependent_for_#{name}" + method = "#{macro}_dependent_for_#{name}" + model.before_destroy lambda { |o| o.public_send method } end def valid_dependent_options -- cgit v1.2.3