diff options
author | lulalala <mark@goodlife.tw> | 2018-04-03 14:14:42 +0800 |
---|---|---|
committer | lulalala <mark@goodlife.tw> | 2019-03-31 22:59:12 +0800 |
commit | 582a8e2f9473af9942c00d9c41b6ca109d6ca7d7 (patch) | |
tree | f60788c9fcee1d8ee9d04159fdf45652d0dfdf59 /activemodel | |
parent | 86620cc3aa8e2630bc8d934b1a86453276b9eee9 (diff) | |
download | rails-582a8e2f9473af9942c00d9c41b6ca109d6ca7d7.tar.gz rails-582a8e2f9473af9942c00d9c41b6ca109d6ca7d7.tar.bz2 rails-582a8e2f9473af9942c00d9c41b6ca109d6ca7d7.zip |
String override options in #import to convert to symbol
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 5 |
1 files changed, 5 insertions, 0 deletions
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 |