Monthly Archives: May 2015

[rails] select distinct values of a column

The simplest way to select all distinct values of a column is, somewhat unintuitively: Visit.uniq.pluck(:project) this runs the query select distinct project from visits, and returns an array of strings. Exactly what you need, except … I want it to be paginated. So we Visit.uniq.pluck(:project).page(1) … and that completely bombs: we now get an array […]