lib/aws/record/validations.rb in aws-sdk-1.8.0 vs lib/aws/record/validations.rb in aws-sdk-1.8.1
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
@@ -40,11 +40,12 @@
#
# validates_presence_of :title, :author
#
# validates_length_of :summary,
# :max => 500,
- # :allow_nil => true
+ # :allow_nil => true,
+ # :allow_blank => true
#
# end
#
# = Conditional Validations
#
@@ -215,10 +216,12 @@
#
# @option options [String] :message A custom error message. The default
# +:message+ is "must be accepted".
# @option options [Boolean] :allow_nil (true) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (true) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -263,11 +266,12 @@
# === Multi-Valued Attributes
#
# This validator works only with single-valued attributes.
# It should not be used on attributes that have array or set values.
#
- # @note This validation method does not accept the +:allow_nil+ option.
+ # @note This validation method does not accept the +:allow_nil+ or the
+ # +:allow_blank+ options.
#
# @overload validates_confirmation_of(*attributes, options = {}, &block)
# @param attributes A list of attribute names to validate.
# @param [Hash] options
# @option options [String] :message A custom error message. The default
@@ -391,10 +395,12 @@
# @overload validates_each(*attributes, options = {}, &block)
# @param attributes A list of attribute names to validate.
# @param [Hash] options
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -437,10 +443,12 @@
# ensure the value is not in.
# @option options [String] :message A custom error message. The default
# +:message+ is "is reserved".
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -486,10 +494,12 @@
# must match, or an error is added.
# @option options [String] :message A custom error message. The default
# +:message+ is "is reserved".
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -523,10 +533,12 @@
# check for the value in.
# @option options [String] :message A custom error message. The default
# +:message+ is "is not included in the list".
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -584,10 +596,12 @@
# added when the attribute has the incorrect length (as
# specified by +:exactly+). Defaults to <code>"is the wrong
# length (should be %{exactly} characters"</code>
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -634,10 +648,12 @@
# an odd integer. This forces the +:only_integer+ to +true+.
# @option options [String] :message A custom error message. The default
# +:message+ is "is not a number".
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol] :on (:save) When this validation is run.
# Valid values include:
# * +:save+
# * +:create+
# * +:update+
@@ -670,9 +686,11 @@
# * +:save+
# * +:create+
# * +:update+
# @option options [Boolean] :allow_nil (false) Skip validation if the
# attribute value is +nil+.
+ # @option options [Boolean] :allow_blank (false) Skip validation if the
+ # attribute value is +blank+.
# @option options [Symbol,String,Proc] :if Specifies a method or proc
# to call. The validation will only be run if the return value is
# of the method/proc is true (e.g. +:if => :name_changed?+ or
# +:if => lambda{|book| book.in_stock? }+).
# @option options [Symbol,String,Proc] :unless Specifies a method or