I get this message when I run my feature specs:
DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement.
I am using Rails 5.0.0.rc1 and am not sure what is throwing this deprecation warning.
I had this in my application.rb
file. I removed it and the deprecation warning went away:
config.active_record.raise_in_transactional_callbacks = true
I'd like tips on what this deprecation warning actually means and to know what triggers this deprecation warning.
I believe this behaviour was added between 4.1 and 4.2 as a temporary solution to a problem which is no longer relevant in rails 5:
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#error-handling-in-transaction-callbacks
Currently, Active Record suppresses errors raised within after_rollback or after_commit callbacks and only prints them to the logs. In the next version, these errors will no longer be suppressed. Instead, the errors will propagate normally just like in other Active Record callbacks.
When you define an after_rollback or after_commit callback, you will receive a deprecation warning about this upcoming change. When you are ready, you can opt into the new behavior and remove the deprecation warning by adding following configuration to your config/application.rb:
config.active_record.raise_in_transactional_callbacks = true
For clarification, as @pixelearth suggests my comment below isn't clear/prominent enough. In Rails 5 and later remove the line from config/application.rb
:
config.active_record.raise_in_transactional_callbacks = true
Writing this here for more visbility for @R. Hatherall's comment.
I was getting this warning when upgrading to 5 not becuase I DIDN't have the following setting in application.rb, but because I DID.
In rails 5 remove the following line from application.rb
config.active_record.raise_in_transactional_callbacks = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With