0
@@ -711,7 +711,8 @@ module ActiveRecord
0
configure_dependency_for_has_many(reflection)
0
- add_multiple_associated_save_callbacks(reflection.name) unless options[:validate] == false
0
+ add_multiple_associated_validation_callbacks(reflection.name) unless options[:validate] == false
0
+ add_multiple_associated_save_callbacks(reflection.name)
0
add_association_callbacks(reflection.name, reflection.options)
0
@@ -801,7 +802,7 @@ module ActiveRecord
0
- add_single_associated_
save_callbacks(reflection.name) if options[:validate] == true
0
+ add_single_associated_
validation_callbacks(reflection.name) if options[:validate] == true
0
association_accessor_methods(reflection, HasOneAssociation)
0
association_constructor_method(:build, reflection, HasOneAssociation)
0
association_constructor_method(:create, reflection, HasOneAssociation)
0
@@ -940,7 +941,7 @@ module ActiveRecord
0
- add_single_associated_
save_callbacks(reflection.name) if options[:validate] == true
0
+ add_single_associated_
validation_callbacks(reflection.name) if options[:validate] == true
0
configure_dependency_for_belongs_to(reflection)
0
@@ -1043,7 +1044,8 @@ module ActiveRecord
0
def has_and_belongs_to_many(association_id, options = {}, &extension)
0
reflection = create_has_and_belongs_to_many_reflection(association_id, options, &extension)
0
- add_multiple_associated_save_callbacks(reflection.name) unless options[:validate] == false
0
+ add_multiple_associated_validation_callbacks(reflection.name) unless options[:validate] == false
0
+ add_multiple_associated_save_callbacks(reflection.name)
0
collection_accessor_methods(reflection, HasAndBelongsToManyAssociation)
0
# Don't use a before_destroy callback since users' before_destroy
0
@@ -1163,7 +1165,7 @@ module ActiveRecord
0
- def add_single_associated_
save_callbacks(association_name)
0
+ def add_single_associated_
validation_callbacks(association_name)
0
method_name = "validate_associated_records_for_#{association_name}".to_sym
0
define_method(method_name) do
0
association = instance_variable_get("@#{association_name}")
0
@@ -1175,7 +1177,7 @@ module ActiveRecord
0
- def add_multiple_associated_
save_callbacks(association_name)
0
+ def add_multiple_associated_
validation_callbacks(association_name)
0
method_name = "validate_associated_records_for_#{association_name}".to_sym
0
ivar = "@#{association_name}"
0
@@ -1196,6 +1198,10 @@ module ActiveRecord
0
+ def add_multiple_associated_save_callbacks(association_name)
0
+ ivar = "@#{association_name}"
0
method_name = "before_save_associated_records_for_#{association_name}".to_sym
0
define_method(method_name) do
0
@@ -1217,7 +1223,6 @@ module ActiveRecord
0
records_to_save.each { |record| association.send(:insert_record, record) } unless records_to_save.blank?
0
# reconstruct the SQL queries now that we know the owner's id
Comments
No one has commented yet.