提交 c9cc73d0 编写于 作者: D David Heinemeier Hansson

Added the possibility of marking fields as being in error without adding a...

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
上级 54dabd05
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册