You can group by name
and add a having
call as well:
...properties.group(:name).having("count(name) > 1").pluck(:name)
There's no longer any need for the uniq
call because, as you're grouping by name, you'll only get each name returned once.