Update example in Http::Headers object to use .from_hash
#26144
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The documented example at the top of
ActionDispatch::Http::Headers
definition provided a hash for the constructor but in Rails 5 this has changed to now take a request object. An earlier commit introduced aActionDispatch::Http::Headers.from_hash()
method that the example should now be using.Other Information
When initializing an
ActionDispatch::Http::Headers
object it takes a request object (Rails 5) whereas before it took a hash (Rails 4.x) but the documented example still shows a hash given to the constructor (due to commit 34fa665 by @tenderlove) so this is just a documentation change to use the newfrom_hash
method introduced in that earlier commit.This is my first PR (I've reported an issue or two before) so I might have the process wrong. Sorry, I was confused with the guidelines on doc changes since this is for the documented example in the code file rather than pages in the guides. I take it its done in the right place. If not let me know what I have to do and be happy to update. Thanks.