Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,22 @@ def call(env)
private

def clear_connections
if should_clear_all_connections?
ActiveRecord::Base.clear_all_connections!
if ActiveRecord::VERSION::MAJOR >= 6
if should_clear_all_connections?
ActiveRecord::Base.connection_handlers.each_value do |connection_handler|
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.
Probably fixed to work with Rails 6.1.

Do you know a better way to get a list of roles?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection_handler.clear_all_connections!
end
else
ActiveRecord::Base.connection_handlers.each_value do |connection_handler|
connection_handler.clear_active_connections!
end
end
else
ActiveRecord::Base.clear_active_connections!
if should_clear_all_connections?
ActiveRecord::Base.clear_all_connections!
else
ActiveRecord::Base.clear_active_connections!
end
end
end

Expand Down