Permalink
Browse files

reduce evals in depdendent associations

  • Loading branch information...
1 parent a63a964 commit 8777ae1f4ac42dd47c3455cf40c9cf59daad7ca9 @tenderlove tenderlove committed Jun 11, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 activerecord/lib/active_record/associations/builder/association.rb
View
3 activerecord/lib/active_record/associations/builder/association.rb
@@ -117,7 +117,8 @@ def #{macro}_dependent_for_#{name}
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

0 comments on commit 8777ae1

Please sign in to comment.