def association_valid?(reflection, record)
      return true if record.destroyed? || record.marked_for_destruction?

      unless valid = record.valid?
        if reflection.options[:autosave]
          record.errors.each do |attribute, message|
            attribute = "#{reflection.name}.#{attribute}"
            errors[attribute] << message
            errors[attribute].uniq!
          end
        else
          errors.add(reflection.name)
        end
      end
      valid
    end
def association_valid?(reflection, record)
      return true if record.destroyed? || record.marked_for_destruction?

      unless valid = record.valid?
        if reflection.options[:autosave]
          record.errors.each do |attribute, message|
            attribute = "#{reflection.name}.#{attribute}"
            errors[attribute] << message
            errors[attribute].uniq!
          end
        else
          errors.add(reflection.name)
        end
      end
      valid
    end
Returns whether or not the association is valid and applies any errors to
 the parent, <tt>self</tt>, if it wasn't. Skips any <tt>:autosave</tt>
 enabled records if they're marked_for_destruction? or destroyed.