提交 aa37991e 编写于 作者: A amitkumarsuroliya

Improved `KeyError` messages on bang version, since commit...

Improved `KeyError` messages on bang version, since commit https://github.com/rails/rails/commit/e768c519fb6015e00961702a5165c6dab548a954 bang version produces `KeyError` [ci skip]
上级 1d8d3b37
......@@ -20,7 +20,7 @@ module ActiveSupport
# To raise an exception when the value is blank, append a
# bang to the key name, like:
#
# h.dog! # => raises KeyError
# h.dog! # => raises KeyError: key not found: :dog
#
class OrderedOptions < Hash
alias_method :_get, :[] # preserve the original #[] method
......
......@@ -1048,7 +1048,7 @@ If you want an exception to be raised when some key is blank, use the bang
version:
```ruby
Rails.application.secrets.some_api_key! # => raises KeyError
Rails.application.secrets.some_api_key! # => raises KeyError: key not found: :some_api_key
```
Additional Resources
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册