add_tag but unique
A product has a many_to_many relationship to a tag (via a product_tag resource).
lib/app/shop/resources/product.ex
This works nicely:
Unfortunately I can also add another "Yellow" tag via an update:
Obviously this should not happen. The "Yellow" tag should be unique.
The longer I think about this the lesser I know how to solve it. Should I through a validation error? How can I do this? Should I just OK it but not adding another tag? How would I do that?
lib/app/shop/resources/product.ex
This works nicely:
Unfortunately I can also add another "Yellow" tag via an update:
Obviously this should not happen. The "Yellow" tag should be unique.
The longer I think about this the lesser I know how to solve it. Should I through a validation error? How can I do this? Should I just OK it but not adding another tag? How would I do that?
