aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 19:46:16 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 19:46:16 +0000
commitc9cc73d0e97db72cb24a7d6db54c0751444470f9 (patch)
tree93a43da989444a7d9623bbd5fdf613358a6f8243
parent54dabd05e67ed4db1370757efe7610a783852976 (diff)
downloadrails-c9cc73d0e97db72cb24a7d6db54c0751444470f9.tar.gz
rails-c9cc73d0e97db72cb24a7d6db54c0751444470f9.tar.bz2
rails-c9cc73d0e97db72cb24a7d6db54c0751444470f9.zip
Added the possibility of marking fields as being in error without adding a message (using nil) to it thatll get displayed wth full_messages #208 [mjobin]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@135 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-xactiverecord/lib/active_record/validations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index dda282115f..2ae4edbb2d 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -49,7 +49,7 @@ module ActiveRecord
alias_method :update_attribute_without_validation_skipping, :update_attribute
alias_method :update_attribute, :update_attribute_with_validation_skipping
- VALIDATIONS.each { |vd| base.class_eval("def self.#{vd}(*methods) write_inheritable_array(\"#{vd}\", methods) end") }
+ VALIDATIONS.each { |vd| base.class_eval("def self.#{vd}(*methods) write_inheritable_array(\"#{vd}\", methods - (read_inheritable_attribute(\"#{vd}\") || [])) end") }
end
base.extend(ClassMethods)
@@ -353,7 +353,7 @@ module ActiveRecord
if attr == "base"
full_messages << msg
else
- full_messages << @base.class.human_attribute_name(attr) + " " + msg
+ full_messages << @base.class.human_attribute_name(attr) + " " + msg unless msg.nil?
end
end
end