Product.select(‘distinct category_id’) #=> SELECT distinct category_id FROM “products” Product.select(‘distinct category_id’).where(‘category_id not null’) #=> SELECT distinct category_id FROM “products” WHERE (category_id not null)Read More →