Permalink
Browse files

Added the possibility of marking fields as being in error without add…

…ing 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
  • Loading branch information...
1 parent 54dabd0 commit c9cc73d0e97db72cb24a7d6db54c0751444470f9 @dhh dhh committed Dec 12, 2004
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/validations.rb
@@ -49,7 +49,7 @@ def self.append_features(base) # :nodoc:
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 @@ def full_messages
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

0 comments on commit c9cc73d

Please sign in to comment.