Remove superfluous return value from 'before' callbacks#313
Open
Remove superfluous return value from 'before' callbacks#313
Conversation
Contributor
Author
|
My current guess is that without the "true" our callbacks evaluate to a
falsy value (e.g. nil) and that causes an abort on 5.0. Will check some
other time. (Weird thing is, I think I tried the configuration to get the
new behavior and it didn't help.)
|
Member
If you were setting it in config/application.rb, it's being overridden by this: nztrain/config/initializers/new_framework_defaults.rb Lines 24 to 25 in 5f00a74 I'll push some changes here to opt into the new behavior, hopefully that's fine. |
35de223 to
d950b8c
Compare
Contributor
Author
|
Thanks, please do.
|
In Rails 5.0, halting a 'before' callback by returning false is deprecated in favour of `throw(:abort)`, and in Rails 5.1 that feature is removed. All our callbacks currently return true, so this shouldn't cause any changes in behaviour. See https://guides.rubyonrails.org/v5.2/upgrading_ruby_on_rails.html#halting-callback-chains-via-throw-abort
These were only necessary to avoid halting callback chains under the previous behaviour.
d950b8c to
798324f
Compare
bagedevimo
approved these changes
Jul 11, 2025
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.
Reminder for myself to look into this (help welcome). I thought it would be a simple but I get errors; maybe this needs to wait for Rails 5.1, or maybe I misunderstood the documentation, specifically what they mean by "return". Relevant Rails code: deprecation, removal.