Skip to content

Conversation

jonatack
Copy link
Contributor

Despite the config name, it isn't super clear when to use true or false for this config and which of the two is the new default. I remember searching in the docs to make sure I got it right. Clarifying it here might help others to be sure they got it right, too.

[skip ci]

@rails-bot
Copy link

r? @sgrif

(@rails-bot has picked a reviewer for you, use r? to override)

@sgrif
Copy link
Contributor

sgrif commented Dec 20, 2015

Can we just add docs for the setting instead? I don't think we need to exhaustively document config options in the config file itself.

@jonatack jonatack force-pushed the clarify-explanation-for-new-config-halt-callback-chains branch from 76308be to 6d59427 Compare December 20, 2015 20:51
@jonatack
Copy link
Contributor Author

Moved docs from the config file to the Configuring Guide.

@jonatack
Copy link
Contributor Author

The generated config file defaults to false, but if no setting is given the default is true as per the change log reproduced below. Will update the docs to clarify that.

Newly generated Rails apps have a new initializer called
`callback_terminator.rb` which sets the value of the configuration option
`ActiveSupport.halt_callback_chains_on_return_false` to `false`.

As a result, new Rails apps do not halt Active Record and Active Model
callback chains when a callback returns `false`; only when they are
explicitly halted with `throw(:abort)`.

The terminator is *not* added when running `rake rails:update`, so returning
`false` will still work on old apps ported to Rails 5, displaying a
deprecation warning to prompt users to update their code to the new syntax.

@jonatack jonatack force-pushed the clarify-explanation-for-new-config-halt-callback-chains branch from 6d59427 to 92cf6cd Compare December 20, 2015 21:26
@claudiob
Copy link
Member

Your latest comment looks good 🎀

# so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
# Do not halt callback chains when a callback returns false. This is a new
# Rails 5.0 default, so it is introduced as a config to ensure that apps made
# on earlier versions of Rails are not affected when upgrading.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like quite a story, particularly given that the only people who see this (new 5.0 apps) really shouldn't care about it at all.

Have we previously been this verbose on similar config values?

(This is more of a general observation about the comment as it already stood, unrelated to your specific changes.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the same addition in active_record_belongs_to_required_by_default.rb.

This change could be removed from this PR and added to another one for both config files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were in 569e03d

@jonatack
Copy link
Contributor Author

@claudiob I hesitate because technically, the default is currently just true during the deprecation period and will switch to false afterward. FWIW your change log rocks.

@jonatack jonatack closed this Dec 21, 2015
@jonatack jonatack reopened this Dec 21, 2015
@claudiob
Copy link
Member

Ok then fine with closing it 😁

@jonatack jonatack force-pushed the clarify-explanation-for-new-config-halt-callback-chains branch from 92cf6cd to bdf280b Compare December 21, 2015 18:16
@rafaelfranca
Copy link
Member

Closing them.

@jonatack
Copy link
Contributor Author

I just updated the PR. The configuration still needs to be explained in the docs.

@rafaelfranca rafaelfranca reopened this Dec 22, 2015
rafaelfranca added a commit that referenced this pull request Dec 22, 2015
…onfig-halt-callback-chains

Clarify config settings for AS::halt_callback_chains_on_return_false
@rafaelfranca rafaelfranca merged commit e4e9d91 into rails:master Dec 22, 2015
@jonatack jonatack deleted the clarify-explanation-for-new-config-halt-callback-chains branch December 22, 2015 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants