From 4b7a439bd17e6d9e8567758ee6a0da13447c3229 Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Sat, 2 Jan 2010 00:49:49 +0100 Subject: [PATCH] Don't use strings for callbacks, as these will be evaled. Rather use symbols, which uses a direct method dispatch. Patch by Comron Sattari. [#3429 state:resolved] --- activerecord/lib/active_record/autosave_association.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 025613545596c..119b902894e9c 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -164,8 +164,8 @@ def #{type}(name, options = {}) # guards that check if the save or validation methods have already been # defined before actually defining them. def add_autosave_association_callbacks(reflection) - save_method = "autosave_associated_records_for_#{reflection.name}" - validation_method = "validate_associated_records_for_#{reflection.name}" + save_method = :"autosave_associated_records_for_#{reflection.name}" + validation_method = :"validate_associated_records_for_#{reflection.name}" force_validation = (reflection.options[:validate] == true || reflection.options[:autosave] == true) if reflection.collection_association?