Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #30623 from manojmj92/manojmj92-oo-key-patch
make documentation consistent with  KeyError message
  • Loading branch information
javan committed Sep 20, 2017
2 parents 1e40df6 + 80f4665 commit 30767f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/ordered_options.rb
Expand Up @@ -24,7 +24,7 @@ module ActiveSupport
# To raise an exception when the value is blank, append a
# bang to the key name, like:
#
# h.dog! # => raises KeyError: key not found: :dog
# h.dog! # => raises KeyError: :dog is blank
#
class OrderedOptions < Hash
alias_method :_get, :[] # preserve the original #[] method
Expand All @@ -46,7 +46,7 @@ def method_missing(name, *args)
bangs = name_string.chomp!("!")

if bangs
fetch(name_string.to_sym).presence || raise(KeyError.new("#{name_string} is blank."))
fetch(name_string.to_sym).presence || raise(KeyError.new(":#{name_string} is blank"))
else
self[name_string]
end
Expand Down
2 changes: 1 addition & 1 deletion guides/source/security.md
Expand Up @@ -1049,7 +1049,7 @@ If you want an exception to be raised when some key is blank, use the bang
version:

```ruby
Rails.application.credentials.some_api_key! # => raises KeyError: key not found: :some_api_key
Rails.application.credentials.some_api_key! # => raises KeyError: :some_api_key is blank
```

Additional Resources
Expand Down

0 comments on commit 30767f9

Please sign in to comment.