Closed machty closed 2 years ago
I have not attempted a PR myself, but if I recall correctly from an issue discussion long ago, it comes down to database agnosticism: DISTINCT ON
is a Postgres-specific feature and a design goal of ActiveRecord is to abstract those kinds of details away.
I don't actively use this gem anymore, so I don't plan to open an issue or PR against Rails, but if someone else would like to, they are welcome to use the code from this gem.
Looks like this is an unmerged PR against rails to merge support for DISTINCT ON: https://github.com/rails/rails/issues/17706
Closing this issue, no further questions your honor.
I'm a bit confused how the Rails API has an Arel Visitor or DISTINCT ON, and that distinct appears to accept a set of columns to perform a DISTINCT ON operation (but in my own tests it doesn't seem to actually cause a DISTINCT ON query to be made)... if these APIs are present in Rails, why don't they work all the way? Also, have you considered putting in a PR against Rails proper? It seems like this functionality should just exist in Rails.