Running the following code to add an association enters multiple entries each time the code is ran:
store.categories << category
Is there a way to make it only enter unique associations between the two models in the db?
Directly from the rails guides, hope it helps:
class Person
has_many :readings
has_many :posts, :through => :readings, :uniq => true
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With