Rails 5 upgrade Halt callback config issue

I have recently upgraded from Rails 4.2 to 5.0.6 . I know about the change in callback halting using throw(:abort) instead of returning false. My problem is that I can’t make the deprecation warnings go away.

DEPRECATION WARNING: Returning false in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1. To explicitly halt the callback chain, please use throw :abort instead.

I have made config/initializers/callback_terminator.rb file with following code

ActiveSupport.halt_callback_chains_on_return_false = false


but I am not still not able to get rid of the warning. Nor am I getting the expected behavior. If I return false from call back it stops the action. It seems that this configuration is not being applied. I am experiencing this in both dev and test environments.

Is there something I am missing?

Any help will be highly appreciated.


Removing this line doesn’t do anything and defaults to Old behavior.

I have confirmed that the file callback_terminator.rb is being loaded properly.

I have tinkered with the problem. When I do add the config in config.after_initialize block it works.

    config.after_initialize do
ActiveSupport.halt_callback_chains_on_return_false = false

But it still doesn’t work if I put it in an initializer file. Problem solved for me though.