I have an application that uses the Ransack gem and I convert it from Mysql to Postgres.
In the case when the sort column is associated with the corresponding table, and for a separate parameter is set to true, Postgres generates this error:
PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
The Ransack github page says that in this case, "yourself."
What is the best - any! - a strategy to handle 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!
ruby ruby-on-rails ruby-on-rails-4 rails-postgresql ransack
ricsrock
source share