I have a pretty simple HABTM set of models
class Tag < ActiveRecord::Base has_and_belongs_to_many :posts end class Post < ActiveRecord::Base
In Rails4:
class Post < ActiveRecord::Base has_and_belongs_to_many :tags, -> { uniq }
(beware, the -> { uniq } must be directly after the relation name, before other params)
-> { uniq }
Rails documentation