    # File lib/active_record/validations.rb, line 669
          def validates_associated(*attr_names)
            configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save }
            configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)

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