validates_associated (ActiveRecord::Validations::ClassMethods)

    # File lib/active_record/validations.rb, line 794
          def validates_associated(*attr_names)
            configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save }
            configuration.update(attr_names.extract_options!)

            validates_each(attr_names, configuration) do |record, attr_name, value|
              record.errors.add(attr_name, configuration[:message]) unless
                (value.is_a?(Array) ? value : [value]).inject(true) { |v, r| (r.nil? || r.valid?) && v }
            end
          end