diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 07:52:29 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 07:52:29 +0000 |
commit | 20d27f6b743bc3425a75b0d07fd79b76e68d37e8 (patch) | |
tree | 1a4358d95eb00e48442382e0a6e5f7dc37c4d0ba /activerecord/lib | |
parent | 9ac02777e7fc81369e5a837124aff51a7ca03d2b (diff) | |
download | rails-20d27f6b743bc3425a75b0d07fd79b76e68d37e8.tar.gz rails-20d27f6b743bc3425a75b0d07fd79b76e68d37e8.tar.bz2 rails-20d27f6b743bc3425a75b0d07fd79b76e68d37e8.zip |
Fixed validates_numericality_of to work with overrided getter-method when :allow_nil is on #1316 [raidel@onemail.at]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1603 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index fb207ef4b2..d2bd5b6511 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -619,6 +619,7 @@ module ActiveRecord end else validates_each(attr_names,configuration) do |record, attr_name,value| + next if configuration[:allow_nil] and record.send("#{attr_name}_before_type_cast").nil? begin Kernel.Float(record.send("#{attr_name}_before_type_cast").to_s) rescue ArgumentError, TypeError |