I know this is a known bug: 1. http://stackoverflow.com/questions/19748959/ransack-postgres-sort-on-column-from-associated-table-with-distinct-true 2. http://stackoverflow.com/questions/19910574/distinct-for-sorting-with-ransack but is there a fix? This code works: ``` def index @search = LogFile.search(params[:q]) @log_files = @search.result(distinct: false).includes(:search_statistic).page(params[:page]).per(5) end ``` This code does not: ``` def index @search = LogFile.search(params[:q]) @log_files = @search.result(distinct: true).includes(:search_statistic).page(params[:page]).per(5) end ``` Error: ``` PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list ```