aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-07 21:34:35 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-07 21:34:35 +0000
commit7c4b6a55b61229ef5f2f053c9a88a738497c70cf (patch)
tree0bdfe35471e6b59eca21ade46a30e081711dc8d9 /activerecord
parent9d9ac01c7ddf1d3af1ee2151e2977d3ee9e48294 (diff)
downloadrails-7c4b6a55b61229ef5f2f053c9a88a738497c70cf.tar.gz
rails-7c4b6a55b61229ef5f2f053c9a88a738497c70cf.tar.bz2
rails-7c4b6a55b61229ef5f2f053c9a88a738497c70cf.zip
Rollback [4917]. Closes #785.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/validations.rb3
-rwxr-xr-xactiverecord/test/validations_test.rb4
3 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 2aaa62a7b5..9c5f3adb55 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -12,8 +12,6 @@
* Optimistic locking: gracefully handle nil versions, treat as zero. #5908 [Tom Ward]
-* validates_confirmation_of only kicks in when the attribute, rather than its confirmation, is present. #785 [z@wzph.com]
-
* to_xml: the :methods option works on arrays of records. #5845 [Josh Starcher]
* Deprecation: update docs. #5998 [jakob@mentalized.net, Kevin Clark]
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index c9d4740670..43552e092c 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -333,8 +333,7 @@ module ActiveRecord
attr_accessor *(attr_names.map { |n| "#{n}_confirmation" })
validates_each(attr_names, configuration) do |record, attr_name, value|
- confirm = record.send("#{attr_name}_confirmation")
- record.errors.add(attr_name, configuration[:message]) unless value.nil? || value == confirm
+ record.errors.add(attr_name, configuration[:message]) unless record.send("#{attr_name}_confirmation").nil? or value == record.send("#{attr_name}_confirmation")
end
end
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb
index 4b6c1bfe1c..936c36e6cb 100755
--- a/activerecord/test/validations_test.rb
+++ b/activerecord/test/validations_test.rb
@@ -179,11 +179,11 @@ class ValidationsTest < Test::Unit::TestCase
assert t.valid?
t.title_confirmation = "Parallel Lives"
- assert t.valid?
+ assert !t.valid?
t.title_confirmation = nil
t.title = "Parallel Lives"
- assert !t.valid?
+ assert t.valid?
t.title_confirmation = "Parallel Lives"
assert t.valid?