Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't remove transactional callbacks deprecation warning (issued from gems) #18084

Closed
Envek opened this issue Dec 18, 2014 · 8 comments
Closed

Comments

@Envek
Copy link
Contributor

Envek commented Dec 18, 2014

I'm trying to upgrade my app to upcoming Rails 4.2 (RC 3) and according to upgrading manual I've placed next string to config/application.rb:

config.active_record.raise_in_transactional_callbacks = true

But I still getting next output immediately after rails server:

DEPRECATION WARNING: Currently, Active Record suppresses errors raised within `after_rollback`/`after_commit` callbacks and only print 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.

You can opt into the new behavior and remove this warning by setting:

  config.active_record.raise_in_transactional_callbacks = true

 (called from block in <module:Base> at /Users/anovikov/.rvm/gems/ruby-2.1.5-gost/bundler/gems/thinking-sphinx-43110fdcf9e8/lib/thinking_sphinx/active_record/base.rb:8)
=> Booting WEBrick
=> Rails 4.2.0.rc3 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-12-18 12:44:53] INFO  WEBrick 1.3.1
[2014-12-18 12:44:53] INFO  ruby 2.1.5 (2014-11-13) [x86_64-darwin14.0]
[2014-12-18 12:44:53] INFO  WEBrick::HTTPServer#start: pid=72022 port=3000

After some playing with puts in config/application.rb I've encountered that thinking_sphinx's file /lib/thinking_sphinx/active_record/base.rb is getting required before the most part of my app's config/application.rb is executed.

At this point I've using code from today's develop branch of thinking sphinx. I've tried to roll back to published version 3.1.2 and then I've get this warning issued somewhere from bundler: ~/.rvm/gems/ruby-2.1.5-gost@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76. I've played with puts more and encountered that it's issued while requiring gem better_errors, but it seems unrelated to Active Record at all. Weird.

Any ideas how to solve this?

@rafaelfranca
Copy link
Member

This is a huge problem at thinking_sphinx, it means that any Active Record configuration you place in your application will not be applied because thinking_sphinx already loaded ActiveRecord::Base before the configurations being set.

You should open an issue there.

@atstockland
Copy link

I am unable to extinguish warning also. Im not using thinking_sphinx.

@pat
Copy link
Contributor

pat commented Dec 23, 2014

@atstockland the warning should mention a line of code which is causing it to be loaded early - the example above by @Envek is from Thining Sphinx. What's that line of code for you?

@atstockland
Copy link

Hi @pat. Here is the full trace when I load the console.
➜ xxxxxxxxxxxxxxx git:(master) ✗ be rails c
DEPRECATION WARNING: Currently, Active Record suppresses errors raised within after_rollback/after_commit callbacks and only print 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.

You can opt into the new behavior and remove this warning by setting:

config.active_record.raise_in_transactional_callbacks = true

(called from require at /Users/Hank/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76)
Loading development environment (Rails 4.2.0)

I don't have any after_rollback or after_commit calls, so its coming from a gem. I updated gems and bundler... Any ideas? Thanks.

@atstockland
Copy link

After updating gem bundler (again)...now I get a more meaningful message. (called from <top (required)> at /Users/Hank/Sites/StudentFlightRecord/config/application.rb:14). Line 14 is Bundler.require(*Rails.groups).

@pat
Copy link
Contributor

pat commented Dec 23, 2014

Sounds like there's something in your Gemfile that's loading AR stuff too quickly? Shame the warning message doesn't give a few lines to make it more obvious.

@atstockland
Copy link

Ya. Ill run through gem versions again...maybe I still have one that is outdated. Or, Ill remove all gems and add back one at a time and see who is to blame. Thanks @pat.

@sgrif
Copy link
Contributor

sgrif commented Dec 23, 2014

This is not a support forum, please take this to Stack Overflow, or email each other. The contributor team is getting emailed every time you post here.

@rails rails locked and limited conversation to collaborators Dec 23, 2014
lulalala added a commit to lulalala/second_level_cache that referenced this issue Jul 19, 2015
This prevents deprecation message for `after_rollback`/`after_commit`
similar to rails/rails#18084
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants