Alvaro
Alvaro

Reputation: 59

Fixing DEPRECATION WARNING: Calling ActiveRecord::Base.clear_active_connections

I'm working on a Ruby Sinatra app with Active Record and it gets this error message printed in the console with every HTTP call.

I couldn't find anywhere more information about this deprecation or how to fix it.

DEPRECATION WARNING: Calling `ActiveRecord::Base.clear_active_connections! is deprecated. Please call the method directly on the connection handler; for example: `ActiveRecord::Base.connection_handler.clear_active_connections!`. (called from clear_active_connections! at /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.1/lib/active_record/connection_handling.rb:320)

Upvotes: 5

Views: 589

Answers (2)

user1070300
user1070300

Reputation: 896

The sinatra-activerecord gem needs to be at least 2.0.27 to fix this particular deprecation warning

Upvotes: 1

Alvaro
Alvaro

Reputation: 59

Solved. Just needed to update the gem

Upvotes: -1

Related Questions