aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-09-23 18:25:16 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-09-23 18:25:16 +0900
commit962ce60ff1692f6f2ed1a8322319d73b9790d324 (patch)
tree85949af815fca728887d6352b91095f56ff9bd1a /activesupport/lib
parent6c199967fc5c32155684b95628751eb1b5098e13 (diff)
downloadrails-962ce60ff1692f6f2ed1a8322319d73b9790d324.tar.gz
rails-962ce60ff1692f6f2ed1a8322319d73b9790d324.tar.bz2
rails-962ce60ff1692f6f2ed1a8322319d73b9790d324.zip
Make bang version work with `InheritableOptions`
Currently, bang version does not work with `InheritableOptions`. `InheritableOptions` treats the argument Hash as the default value. However, `Hash#fetch` does not use the default value when key is not found, so can not get the default value. So in bang version, should use `Hash#[]` instead of `Hash#fetch`.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/ordered_options.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index c2a37fbdd7..b74510fdb2 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -46,7 +46,7 @@ module ActiveSupport
bangs = name_string.chomp!("!")
if bangs
- fetch(name_string.to_sym).presence || raise(KeyError.new(":#{name_string} is blank"))
+ self[name_string].presence || raise(KeyError.new(":#{name_string} is blank"))
else
self[name_string]
end