method

define_autosave_validation_callbacks

rails latest stable - Class: ActiveRecord::AutosaveAssociation::ClassMethods
define_autosave_validation_callbacks(reflection)
private

No documentation available.

# File activerecord/lib/active_record/autosave_association.rb, line 217
        def define_autosave_validation_callbacks(reflection)
          validation_method = :"validate_associated_records_for_#{reflection.name}"
          if reflection.validate? && !method_defined?(validation_method)
            if reflection.collection?
              method = :validate_collection_association
            else
              method = :validate_single_association
            end

            define_non_cyclic_method(validation_method) { send(method, reflection) }
            validate validation_method
            after_validation :_ensure_no_duplicate_errors
          end
        end