Skip to content

Commit

Permalink
Don't use strings for callbacks, as these will be evaled. Rather use …
Browse files Browse the repository at this point in the history
…symbols, which uses a direct method dispatch.

Patch by Comron Sattari. [#3429 state:resolved]
  • Loading branch information
alloy committed Jan 7, 2010
1 parent c48a71c commit 4b7a439
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/autosave_association.rb
Expand Up @@ -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?
Expand Down

0 comments on commit 4b7a439

Please sign in to comment.