# Multi\_site extension and unique login names

**URL:** <https://www.ruby-forum.com/t/multi-site-extension-and-unique-login-names/154340>\
**Category:** Radiant CMS\
**Created:** [November 28, 2008, 12:21am UTC](https://www.ruby-forum.com/t/multi-site-extension-and-unique-login-names/154340 "2008-11-28T00:21:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya\_Chadha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@Aditya\_Chadha](https://www.ruby-forum.com/u/Aditya_Chadha)\
**Post date:** [November 28, 2008, 12:21am UTC](https://www.ruby-forum.com/t/multi-site-extension-and-unique-login-names/154340/1 "2008-11-28T00:21:22Z")

</div>

Hi folks,

Just playing around with the multi\_site extension and noticed that the  
login field in the users table seems to have a unique validation as  
well as a unique constraint enforced by an index. Not quite sure what  
the best to get around this is, but I would imagine that if you were  
hosting multiple sites you would want the logins to be scoped to site?

I’m not quite sure what the cleanest way of overriding validations is  
but one way could be to add an :if to the  
validates\_uniquness\_of :login in user.rb and then override the method  
that the if calls in the extension. Another way would be to use a  
custom validation. We would obviously have to replace the unique index  
on login with a unique index on login, site\_id

Unfortunately, I can’t see a way of leaving the Radiant code alone…  
the validation needs to change.

Thoughts?

Cheers,  
Aditya

–  
Aditya ([http://aditya.sublucid.com](http://aditya.sublucid.com))

---

<div class="post-metadata">

**Author:** ![Aditya\_Chadha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@Aditya\_Chadha](https://www.ruby-forum.com/u/Aditya_Chadha)\
**Post date:** [December 1, 2008, 8:25pm UTC](https://www.ruby-forum.com/t/multi-site-extension-and-unique-login-names/154340/2 "2008-12-01T20:25:09Z")

</div>

I’d modify the radiant code.

Joe
