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

Fix deprecated call in activerecord adapter #477

Closed
Closed
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/graphiti/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def destroy(model_instance)
end

def close
::ActiveRecord::Base.clear_active_connections!
::ActiveRecord::Base.connection_handler.clear_active_connections!
Copy link
Contributor

Choose a reason for hiding this comment

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

if ActiveRecord.version > '7.2'
::ActiveRecord::Base.connection_handler.clear_active_connections!
else
::ActiveRecord::Base.clear_active_connections!
end

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's assume that not everyone would be able to upgrade to 7.2+ as fast as we need to do it ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

as a quick fix, in the meantime, we could use something like the following:
ActiveRecord::Base.class.delegate :clear_active_connections!, to: :connection_handler
somewhere in an initializer, or such.

Copy link
Contributor

Choose a reason for hiding this comment

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

or a much cleaner version:

ActiveRecord::Base.define_singleton_method :clear_active_connections! do
  connection_handler.clear_active_connections!
end

end

def can_group?
Expand Down
Loading