diff options
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index ac19b4625e..a9af426fb1 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -318,7 +318,7 @@ module ActiveModel group_by_attribute.each do |attribute, errors| hash[attribute] = errors.map(&:detail) end - hash + DeprecationHandlingDetailsHash.new(hash) end def group_by_attribute @@ -672,6 +672,14 @@ module ActiveModel end end + class DeprecationHandlingDetailsHash < SimpleDelegator + def initialize(details) + details.default = [] + details.freeze + super(details) + end + end + # Raised when a validation cannot be corrected by end users and are considered # exceptional. # |