Mark "Remove to_ary from Response` as breaking#1675
Merged
ioquatix merged 1 commit intorack:masterfrom Jun 29, 2020
srpouyet:patch-1
Merged
Mark "Remove to_ary from Response` as breaking#1675ioquatix merged 1 commit intorack:masterfrom srpouyet:patch-1
to_ary from Response` as breaking#1675ioquatix merged 1 commit intorack:masterfrom
srpouyet:patch-1
Conversation
Response `to_ary` was removed in commit 72959eb. This is a breaking change if the response is used for multiple assignment. Example (works for < 2.1.0): ``` status, headers, body = response ``` The value of `headers` will be `nil` in version > 2.1.0. To prevent this the response must be explicitly cast to an array with `to_a`.
Member
|
I feel like this ship has already sailed but I'm okay to merge. @tenderlove ? |
Member
|
I'm fine to merge this too |
Contributor
Author
|
Cheers! Maybe this'll save someone who comes comes across this issue some time 👍 Also, thank you guys for your OSS-efforts. Much appreciated! |
ch1c0t
added a commit
to ch1c0t/hobby
that referenced
this pull request
Mar 26, 2021
Contributor
|
Thank you. This notice was very helpful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Response
to_arywas removed in commit 72959eb.This is a breaking change if the response is used for multiple assignment of variables.
Example that worked with < 2.1.0:
With version 2.1.0 the value of
headerschanges from a hash tonil.To prevent this the response must be explicitly cast to an array with
to_aas noted in the commit message of the change.We had an issue with a custom rack app whose
callmethod returnedRack::Response.new(json). This worked fine in version 2.0.2, but caused aNoMethodErrorin action_dispatch/journey/router.rb.We think it's a good idea to mark this change as breaking in the changelog, so people will be able to check their code before upgrading, what do you think?