I have an app that uses the Ransack gem and I'm converting it from Mysql to Postgres.
In an instance where the sort column is from an associated table and the distinct option is set to true, Postgres throws this error:
PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
The Ransack github page says that, in a case like this, "you're on your own."
What's the best - any! - strategy for handling this scenario?
q = Contact.includes(:contact_type).search
q.sorts = ['contact_type_name asc']
q.result(distinct: true)
PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Thanks!