Rails 5 upgrade Halt callback config issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Rails 5 upgrade Halt callback config issue

Muhammad Ibraheem

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?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6c830eb3-88b7-46d9-ba1d-abada30c1805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

Muhammad Ibraheem
Any help will be highly appreciated.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f6256a4e-2ddf-4c4b-997a-d18c00b8f445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

nanaya-2
In reply to this post by Muhammad Ibraheem
Hi,

On Fri, Dec 8, 2017, at 16:55, Muhammad Ibraheem wrote:

>
>
> I have made config/initializers/callback_terminator.rb file with
> following
> code
>
>
> ActiveSupport.halt_callback_chains_on_return_false = false
>
>

You need to remove the whole line, not just setting it to false.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1512727834.1892093.1198310752.16D2F832%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

Muhammad Ibraheem
Removing this line doesn't do anything and defaults to Old behavior.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cfc8ab22-c3a6-4e89-a6ff-9a1293491755%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eeb453f1-4ab2-4194-af73-71b855f48fe6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

Muhammad Ibraheem

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
    end

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e53fb377-ee07-4f0e-abd3-b362294c11f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5 upgrade Halt callback config issue

nanaya-2
In reply to this post by Muhammad Ibraheem
Hi,

On Sat, Dec 9, 2017, at 00:29, Muhammad Ibraheem wrote:
> Removing this line doesn't do anything and defaults to Old behavior.
>


Whoops sorry, I checked this on a 5.1 app which the option doesn't do
anything anymore.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1512756388.3789210.1198768536.5D33E6D3%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.