aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavan Makhmali <javan@javan.us>2017-09-20 07:29:12 -0400
committerGitHub <noreply@github.com>2017-09-20 07:29:12 -0400
commit30767f980faa2d7a0531774ddf040471db74a23b (patch)
tree9f68220baf0db9e45c7b830070b67d9ba8b00f4a
parent1e40df6ffbdb2b0907bd0a0a66eeac5d942be360 (diff)
parent80f46653e2353a40a7175cbd6030dcf60916d6cd (diff)
downloadrails-30767f980faa2d7a0531774ddf040471db74a23b.tar.gz
rails-30767f980faa2d7a0531774ddf040471db74a23b.tar.bz2
rails-30767f980faa2d7a0531774ddf040471db74a23b.zip
Merge pull request #30623 from manojmj92/manojmj92-oo-key-patch
make documentation consistent with KeyError message
-rw-r--r--activesupport/lib/active_support/ordered_options.rb4
-rw-r--r--guides/source/security.md2
2 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index fa7825b3ba..c2a37fbdd7 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -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
@@ -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."))
+ fetch(name_string.to_sym).presence || raise(KeyError.new(":#{name_string} is blank"))
else
self[name_string]
end
diff --git a/guides/source/security.md b/guides/source/security.md
index 746da5e634..0b2d8de0fb 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -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