method

define_autosave_validation_callbacks

Importance_0
v7.1.3.4 - Show latest stable - 0 notes - Class: ActiveRecord::AutosaveAssociation::ClassMethods
define_autosave_validation_callbacks(reflection) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# 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
Register or log in to add new notes.