Validate uniqueness of category model depending on user model

How to make unique validation on category model that is belong to user
model and the unique validation must depend on user model so for
example every user may have their own unique category name but two or
more user may have a same category name but they can’t have a same
category name twice.

could you give an example to explain that a little bit more?

On Feb 18, 8:28 am, Geekyra [email protected] wrote:

How to make unique validation on category model that is belong to user
model and the unique validation must depend on user model so for
example every user may have their own unique category name but two or
more user may have a same category name but they can’t have a same
category name twice.

Use the :scope option on validates_uniqueness_of ?

Fred

For example : (note: change category into product for easier
understanding)
There are 2 user :
“User 1” may have product name it “CAR”, “HOUSE”, “HOUSE@XXX”
“User 2” may have product name it “CAR”, “CAR 2”, “HOUSE@YYY”,
“HOUSE”, “WALLET”

The point is every user may have a same product but they need to
maintain a user uniqueness product so “User 1” can’t have a new
product name “CAR” cos it’s already have it on the first row product.

I will try to look forward for Frederick suggestion, see if
using :scope solve the problem. Thanks for Frederick