aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model
diff options
context:
space:
mode:
authorJeremy Baker <jhubert@gmail.com>2018-07-14 00:57:43 -0500
committerJeremy Baker <jhubert@gmail.com>2018-07-14 13:19:46 -0500
commita19918124d7d7dcaf546294d9357335c43fbc0ac (patch)
tree0f6abf0dacb1decd2e2d917bac8dbd8d449bc481 /activemodel/lib/active_model
parentbd5eba1adff8fa72429f5889ae26097e9756ceb0 (diff)
downloadrails-a19918124d7d7dcaf546294d9357335c43fbc0ac.tar.gz
rails-a19918124d7d7dcaf546294d9357335c43fbc0ac.tar.bz2
rails-a19918124d7d7dcaf546294d9357335c43fbc0ac.zip
Ensure attribute is a symbol in the added? method
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r--activemodel/lib/active_model/errors.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 56404a036c..edc30ee64d 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -328,7 +328,7 @@ module ActiveModel
# person.errors.added? :name, "is too long" # => false
def added?(attribute, message = :invalid, options = {})
if message.is_a? Symbol
- self.details[attribute].map { |e| e[:error] }.include? message
+ self.details[attribute.to_sym].map { |e| e[:error] }.include? message
else
message = message.call if message.respond_to?(:call)
message = normalize_message(attribute, message, options)