From c9cc73d0e97db72cb24a7d6db54c0751444470f9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Dec 2004 19:46:16 +0000 Subject: 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 --- activerecord/lib/active_record/validations.rb | 4 ++-- 1 file 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 -- cgit v1.2.3