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

Connections not being released with ActiveRecord 5 #73

Closed
tommyschaefer opened this issue Mar 3, 2017 · 1 comment
Closed

Connections not being released with ActiveRecord 5 #73

tommyschaefer opened this issue Mar 3, 2017 · 1 comment

Comments

@tommyschaefer
Copy link

tommyschaefer commented Mar 3, 2017

Hi there!

I've run into the same problem as bmizerany#10 using ActiveRecord 5.

I think this is coming from line 33 of lib/sinatra/activerecord:

if ActiveRecord::ConnectionAdapters.const_defined?(:ConnectionManagement)
  app.use ActiveRecord::ConnectionAdapters::ConnectionManagement
end

As far as I can tell, AR 5 doesn't have ActiveRecord::ConnectionAdapters::ConnectionManagement, but I wasn't able to find / see if there's a replacement.

Thank you so much for the time and help!!

@tommyschaefer
Copy link
Author

If there isn't a replacement, I'm wondering if it would make sense to fall back on the original implementation proposed in that PR? Something like:

if ActiveRecord::ConnectionAdapters.const_defined?(:ConnectionManagement)
  app.use ActiveRecord::ConnectionAdapters::ConnectionManagement
else
  app.after { ActiveRecord::Base.clear_active_connections! }
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant