aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-16 11:24:45 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-16 11:24:45 -0800
commit05316ba1278e7feb8ca16907738e10c2ad1a8076 (patch)
treed2e22cdbe3cdad1cb89bd4f17ba83d1629cc52d7 /activemodel/lib
parent5f6bcd74fd3a17911a06ffb09827b90c47ae573f (diff)
parent66e747b461457b4f49d5b5d88334f5019bbfcc1e (diff)
downloadrails-05316ba1278e7feb8ca16907738e10c2ad1a8076.tar.gz
rails-05316ba1278e7feb8ca16907738e10c2ad1a8076.tar.bz2
rails-05316ba1278e7feb8ca16907738e10c2ad1a8076.zip
Merge pull request #4006 from devton/validation_error_on_message_is_empty_part_2
Fixed bug when error message is an empty string.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/errors.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 8337b04c0d..aafd1c8a74 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -176,8 +176,9 @@ module ActiveModel
end
# Returns true if no errors are found, false otherwise.
+ # If the error message is a string it can be empty.
def empty?
- all? { |k, v| v && v.empty? }
+ all? { |k, v| v && v.empty? && !v.is_a?(String) }
end
alias_method :blank?, :empty?