diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-03 17:53:51 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-03 17:53:51 +0000 |
commit | d9839c195288dd5636da1c70f3c34dbc07c6b679 (patch) | |
tree | 669690036289bde0aad0bdf6c140180757fb72d5 | |
parent | 6d17ece9f2558fe6d64a97d0b99493e4de2d32eb (diff) | |
download | rails-d9839c195288dd5636da1c70f3c34dbc07c6b679.tar.gz rails-d9839c195288dd5636da1c70f3c34dbc07c6b679.tar.bz2 rails-d9839c195288dd5636da1c70f3c34dbc07c6b679.zip |
validates_confirmation_of only kicks in when the attribute, rather than its confirmation, is present. Closes #785.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4917 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 6e661787ef..460d7f5f3f 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* 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 03ad90d3e5..c1353e9d56 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -333,7 +333,8 @@ module ActiveRecord attr_accessor *(attr_names.map { |n| "#{n}_confirmation" }) validates_each(attr_names, configuration) do |record, attr_name, value| - record.errors.add(attr_name, configuration[:message]) unless record.send("#{attr_name}_confirmation").nil? or value == record.send("#{attr_name}_confirmation") + confirm = record.send("#{attr_name}_confirmation") + record.errors.add(attr_name, configuration[:message]) unless value.nil? || value == confirm end end |