mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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]
This commit is contained in:
@@ -163,8 +163,8 @@ module ActiveRecord
|
||||
# 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?
|
||||
|
||||
Reference in New Issue
Block a user