From 582a8e2f9473af9942c00d9c41b6ca109d6ca7d7 Mon Sep 17 00:00:00 2001 From: lulalala Date: Tue, 3 Apr 2018 14:14:42 +0800 Subject: String override options in #import to convert to symbol --- activemodel/lib/active_model/errors.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activemodel') diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 2d559e06d4..3ba33bee4d 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -119,6 +119,11 @@ module ActiveModel # @option override_options [Symbol] :attribute Override the attribute the error belongs to # @option override_options [Symbol] :type Override type of the error. def import(error, override_options = {}) + [:attribute, :type].each do |key| + if override_options.key?(key) + override_options[key] = override_options[key].to_sym + end + end @errors.append(NestedError.new(@base, error, override_options)) end -- cgit v1.2.3