<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 25 Jul 2008, at 18:14, Kevin Fullerton wrote:</div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div lang="EN-US" link="blue" vlink="purple"><div class="Section1"><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(31, 73, 125); ">clearing the habtm association if none are selected, apart from where the user is admin and the Role is System Administrator – that must always be selected</div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(31, 73, 125); ">So – should this go in the model in a before_save callback or in the controller – my gut says model</div></div></div></span></blockquote><br></div><div>Yes, it belongs in the model; set up a callback to add the administrator role (to only the admin user) if it's been removed. In fact, assuming that the habtm :roles is :uniq (it should be), then you can just add it regardless.</div><div><br></div><div>Cheers,</div><div>-Tom</div></body></html>