How do you select multiple fields with different values and other implicit fields with them, all in one call using and limit? I tried .pluck (which supports multiple fields in rails 4),. Uniq (which in my case does not work).
This is what worked for me when it is used in a controller action
@models = Model.select('DISTINCT ON (field1,field2,field3) *') .where(id: params[:id]) .limit(100)