Dedupping Has_many through, :unique=>true

I’m not 100% on :unique => true but you should be able to put validation into your join model to prevent these kinds of issues.

eg

validates_uniqueness_of :category_id, :scope => :inventory_id

might do the trick.