ransack icon indicating copy to clipboard operation
ransack copied to clipboard

Delegate alias_tracker creation to AR Relation rather than doing it ourselves

Open robinator opened this issue 9 months ago • 1 comments

Closes #1491.

This PR is addressing an error we are experiencing on edge rails. This error is caused because the API for creating an ActiveRecord::Associations::AliasTracker has changed in edge rails. It now wants to eat a connection pool rather than a connection. Knowing nothing about ransack's internals, from what I can tell it shouldn't need to use this API directly, and should just ask it's ActiveRecord::Relation to create a fresh AliasTracker instead. This patch includes my naive way of doing so. It fixes the breakages in our own test suite. Please let me know if there are other additions I should include.

robinator avatar May 15 '24 14:05 robinator

This branch makes activeadmin specs pass:

https://github.com/activeadmin/activeadmin/pull/8371/files#diff-d09ea66f8227784ff4393d88a19836f321c915ae10031d16c93d67e6283ab55fR16

https://github.com/activeadmin/activeadmin/actions/runs/9438394298/job/25995318087

tagliala avatar Jun 18 '24 14:06 tagliala

This modification solved my problem of undefined method `with_connection' for an instance of ActiveRecord::ConnectionAdapters::PostgreSQLAdapter in rails 7.2

prasea avatar Jul 10 '24 10:07 prasea

@robinator thanks for your contribution! We needed some other changes too to make it work with Rails 7.2 so I cherry-picked your commit in #1503 and closing this one.

gregmolnar avatar Jul 10 '24 23:07 gregmolnar