Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4917

Show
Ignore:
Timestamp:
09/03/06 17:53:51 (2 years ago)
Author:
bitsweat
Message:

validates_confirmation_of only kicks in when the attribute, rather than its confirmation, is present. Closes #785.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r4909 r4917  
    11*SVN* 
     2 
     3* validates_confirmation_of only kicks in when the attribute, rather than its confirmation, is present.  #785 [z@wzph.com] 
    24 
    35* to_xml: the :methods option works on arrays of records.  #5845 [Josh Starcher] 
  • trunk/activerecord/lib/active_record/validations.rb

    r4482 r4917  
    334334 
    335335        validates_each(attr_names, configuration) do |record, attr_name, value| 
    336           record.errors.add(attr_name, configuration[:message]) unless record.send("#{attr_name}_confirmation").nil? or value == record.send("#{attr_name}_confirmation") 
     336          confirm = record.send("#{attr_name}_confirmation") 
     337          record.errors.add(attr_name, configuration[:message]) unless value.nil? || value == confirm 
    337338        end 
    338339      end