Hi,
Say I have 2 models:
Users,
Services
a User can have many services
a Service can have many Users,
However, I need to store extra info for the relation.
So I created the User_Service model etc
All is working fine creating the relationship
However, I want to make sure each user can only be registered to a service once.
At the minute, it just creates a new record.
Is there a way to make "service" unique for a user?
Cheers.
Anyone?
Basically,
I have:
service_users
id, user id, service id, username
1 1 1 username
1 1 1 username
but it shouldnt allow it, however,
1 1 2 username
would be acceptable.
in Rails, you'd have:
has_many :services, :uniq => true