From b95d6e84b00bd926b1118f6a820eca7a870b8c35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- .../lib/active_model/validations/acceptance.rb | 22 +++++++++++----------- .../lib/active_model/validations/confirmation.rb | 20 ++++++++++---------- activemodel/lib/active_model/validations/length.rb | 2 +- .../lib/active_model/validations/validates.rb | 10 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'activemodel/lib/active_model/validations') diff --git a/activemodel/lib/active_model/validations/acceptance.rb b/activemodel/lib/active_model/validations/acceptance.rb index 99b8966def..d9dfe0c855 100644 --- a/activemodel/lib/active_model/validations/acceptance.rb +++ b/activemodel/lib/active_model/validations/acceptance.rb @@ -24,7 +24,7 @@ module ActiveModel end module HelperMethods - # Encapsulates the pattern of wanting to validate the acceptance of a + # Encapsulates the pattern of wanting to validate the acceptance of a # terms of service check box (or similar agreement). Example: # # class Person < ActiveRecord::Base @@ -32,33 +32,33 @@ module ActiveModel # validates_acceptance_of :eula, :message => "must be abided" # end # - # If the database column does not exist, the +terms_of_service+ attribute + # If the database column does not exist, the +terms_of_service+ attribute # is entirely virtual. This check is performed only if +terms_of_service+ # is not +nil+ and by default on save. # # Configuration options: - # * :message - A custom error message (default is: "must be + # * :message - A custom error message (default is: "must be # accepted"). # * :on - Specifies when this validation is active (default is - # :save, other options are :create and + # :save, other options are :create and # :update). # * :allow_nil - Skip validation if attribute is +nil+ (default # is true). - # * :accept - Specifies value that is considered accepted. + # * :accept - Specifies value that is considered accepted. # The default value is a string "1", which makes it easy to relate to - # an HTML checkbox. This should be set to +true+ if you are validating + # an HTML checkbox. This should be set to +true+ if you are validating # a database column, since the attribute is typecast from "1" to +true+ # before validation. # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. :if => :allow_validation, # or :if => Proc.new { |user| user.signup_step > 2 }). The - # method, proc or string should return or evaluate to a true or false + # method, proc or string should return or evaluate to a true or false # value. - # * :unless - Specifies a method, proc or string to call to - # determine if the validation should not occur (for example, - # :unless => :skip_validation, or + # * :unless - Specifies a method, proc or string to call to + # determine if the validation should not occur (for example, + # :unless => :skip_validation, or # :unless => Proc.new { |user| user.signup_step <= 2 }). - # The method, proc or string should return or evaluate to a true or + # The method, proc or string should return or evaluate to a true or # false value. def validates_acceptance_of(*attr_names) validates_with AcceptanceValidator, _merge_attributes(attr_names) diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index 3a80893866..a31966d0c2 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -15,13 +15,13 @@ module ActiveModel end module HelperMethods - # Encapsulates the pattern of wanting to validate a password or email + # Encapsulates the pattern of wanting to validate a password or email # address field with a confirmation. For example: # # Model: # class Person < ActiveRecord::Base # validates_confirmation_of :user_name, :password - # validates_confirmation_of :email_address, + # validates_confirmation_of :email_address, # :message => "should match confirmation" # end # @@ -29,12 +29,12 @@ module ActiveModel # <%= password_field "person", "password" %> # <%= password_field "person", "password_confirmation" %> # - # The added +password_confirmation+ attribute is virtual; it exists only + # The added +password_confirmation+ attribute is virtual; it exists only # as an in-memory attribute for validating the password. To achieve this, - # the validation adds accessors to the model for the confirmation + # the validation adds accessors to the model for the confirmation # attribute. - # - # NOTE: This check is performed only if +password_confirmation+ is not + # + # NOTE: This check is performed only if +password_confirmation+ is not # +nil+, and by default only on save. To require confirmation, make sure # to add a presence check for the confirmation attribute: # @@ -48,11 +48,11 @@ module ActiveModel # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. :if => :allow_validation, # or :if => Proc.new { |user| user.signup_step > 2 }). The - # method, proc or string should return or evaluate to a true or false + # method, proc or string should return or evaluate to a true or false # value. - # * :unless - Specifies a method, proc or string to call to - # determine if the validation should not occur (e.g. - # :unless => :skip_validation, or + # * :unless - Specifies a method, proc or string to call to + # determine if the validation should not occur (e.g. + # :unless => :skip_validation, or # :unless => Proc.new { |user| user.signup_step <= 2 }). The # method, proc or string should return or evaluate to a true or false value. def validates_confirmation_of(*attr_names) diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index ecae73a66e..5a46ecb4ac 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -34,7 +34,7 @@ module ActiveModel end end end - + def validate_each(record, attribute, value) value = options[:tokenizer].call(value) if value.kind_of?(String) diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb index 3260e6bc5a..3242e49269 100644 --- a/activemodel/lib/active_model/validations/validates.rb +++ b/activemodel/lib/active_model/validations/validates.rb @@ -9,7 +9,7 @@ module ActiveModel # validator classes ending in 'Validator'. Note that Rails default # validators can be overridden inside specific classes by creating # custom validator classes in their place such as PresenceValidator. - # + # # Examples of using the default rails validators: # # validates :terms, :acceptance => true @@ -21,7 +21,7 @@ module ActiveModel # validates :age, :numericality => true # validates :username, :presence => true # validates :username, :uniqueness => true - # + # # The power of the +validates+ method comes when using custom validators # and default validators in one call for a given attribute e.g. # @@ -31,15 +31,15 @@ module ActiveModel # value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i # end # end - # + # # class Person # include ActiveModel::Validations # attr_accessor :name, :email - # + # # validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 } # validates :email, :presence => true, :email => true # end - # + # # Validator classes may also exist within the class being validated # allowing custom modules of validators to be included as needed e.g. # -- cgit v1.2.3