From d5cadfc1108728635055d476eff7b34c975705d6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 13 Apr 2005 04:44:58 +0000 Subject: Address parsing failed when the "to" (or "cc", or whatever) was an array. It was also too restrictive in the formats of the addresses #1097 [Jamis] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1149 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/validations.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 9364a2501c..850d012e4d 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -369,27 +369,27 @@ module ActiveRecord # Declare different validations per option. case range_options.first when :within, :in - raise ArgumentError, ':within must be a Range' unless option_value.is_a?(Range) + raise ArgumentError, ':within must be a Range' unless option_value.is_a?(Range) # ' validates_each(attrs, options) do |record, attr| next if record.send(attr).nil? and options[:allow_nil] record.errors.add_on_boundary_breaking(attr, option_value, options[:too_long], options[:too_short]) end when :is - raise ArgumentError, ':is must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 + raise ArgumentError, ':is must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 # ' message = options[:message] || options[:wrong_length] message = (message % option_value) rescue message validates_each(attrs, options) do |record, attr, value| record.errors.add(attr, message) if value.nil? or value.size != option_value end when :minimum - raise ArgumentError, ':minimum must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 + raise ArgumentError, ':minimum must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 # ' message = options[:message] || options[:too_short] message = (message % option_value) rescue message validates_each(attrs, options) do |record, attr, value| record.errors.add(attr, message) if value.nil? or value.size < option_value end when :maximum - raise ArgumentError, ':maximum must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 + raise ArgumentError, ':maximum must be a nonnegative Integer' unless option_value.is_a?(Integer) and option_value >= 0 # ' message = options[:message] || options[:too_long] message = (message % option_value) rescue message validates_each(attrs, options) do |record, attr, value| -- cgit v1.2.3