activerecord-hackery / ransack

Object-based searching.
https://activerecord-hackery.github.io/ransack/
MIT License
5.61k stars 782 forks source link

Delegate alias_tracker creation to AR Relation rather than doing it ourselves #1493

Open robinator opened 1 month ago

robinator commented 1 month ago

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.

tagliala commented 2 weeks ago

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