Memoize the value of show_exceptions?#46609
Closed
skipkayhil wants to merge 2 commits intorails:mainfrom
Closed
Conversation
Previously, the value of `action_dispatch.show_exceptions` would be compared with `false` every time `show_exceptions?` is called. As described in the previous comment, the purpose of the comparison is to treat a `nil` configuration as `true`. This commit does what the rest of the comment suggests, which is to move the comparison into `env_config` so that `show_exceptions?` just looks up the value stored in `env` and doesn't have to do any comparisons.
Member
|
(I wouldn't really characterize this change as memoizing, but) it looks like this changes the behaviour where the middleware is included directly, outside of a |
This doesn't pass a bunch of tests because they rely on being able to set the value dynamically. I wonder if that makes this worth keeping?
Member
Author
|
Closing for now as this won't really work as is, mostly just pushing up my idea so I don't lose it |
4 tasks
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.
Motivation / Background
Previously, the value of
action_dispatch.show_exceptionswould be compared withfalseevery timeshow_exceptions?is called. As described in the previous comment, the purpose of the comparison is to treat anilconfiguration astrue.Detail
This commit does what the rest of the comment suggests, which is to move the comparison into
env_configso thatshow_exceptions?just looks up the value stored inenvand doesn't have to do any comparisons.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]