From: Matt White Date: 2007-09-08T07:13:34+09:00 Subject: Re: enforce mutual exclusivity --0-287761359-1189203213=:33660 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Toby,=0A=0ASeeing as ActiveRecord is part of Rails, you ought to post this = question to the "Ruby on Rails: Talk" group.=0A=0A----- Original Message --= --=0AFrom: Toby O'Rourke =0ATo: ruby-talk ML = =0ASent: Friday, September 7, 2007 3:59:53 PM=0ASu= bject: enforce mutual exclusivity=0A=0AHi,=0A=0AFirst post, sorry if this i= s the wrong place or has been answered before.=0A=0AI'm using ActiveRecord = and I want to enforce mutual exclusivity on a =0Ahas_and_belongs_to_many.= =0A=0AA concrete example: I have a User which can have one or more Roles = =0A(student, tutor, headmaster, administrator etc). However if a user is a = =0Astudent they cannot hold any other role. I was hoping to find something = =0Alike validate_exclusive but that doesn't appear to exist. Can anyone =0A= suggest how I can implement this. Otherwise, is there a better pattern =0A= I could use to model this?=0A=0AMany thanks,=0A=0AToby.=0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A =0A__________________________________________________= __________________________________=0AYahoo! oneSearch: Finally, mobile sear= ch =0Athat gives answers, not web links. =0Ahttp://mobile.yahoo.com/mobilew= eb/onesearch?refer=3D1ONXIC --0-287761359-1189203213=:33660--