The HABTM has a :uniq option that is supposed to ignore uniques.
try
class Product < AR::B
has_and_belongs_to_many :uniq => true
def nice_method(x) self.groups << Group.find(x) end end
I think that should take care of the duplicate value for you.
HTH Daniel