http://apidock.com/rails/ActiveRecord/Calculations/pluck as far as I understand from there, .uniq.pluck translates to "DISTINCT puppetclass_id".