I’m migrating from Rails 4.1 to Rails 5.1 and got the following deprecation warning:
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 added throw(:abort)
in the callbacks but when I run tests, I got a lot of errors like the following:
Error:
UserControllerTest#test_: the update action should have updated user record. :
UncaughtThrowError: uncaught throw :abort
app/controllers/application_controller.rb:298:in `throw'
app/controllers/application_controller.rb:298:in `check_access'
How to fix it?
Thanks Romu