# Shared users

**URL:** <https://www.ruby-forum.com/t/shared-users/113511>\
**Category:** Rails\
**Created:** [August 31, 2007, 11:53pm UTC](https://www.ruby-forum.com/t/shared-users/113511 "2007-08-31T23:53:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcbey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@marcbey](https://www.ruby-forum.com/u/marcbey)\
**Post date:** [August 31, 2007, 11:53pm UTC](https://www.ruby-forum.com/t/shared-users/113511/1 "2007-08-31T23:53:43Z")

</div>

Hi,

I have three RoR apps with the same users. It would be nice if they  
didn’t  
have to create usernames and passwords for each…

What’s the best practice?

1. Create one users table, replicate it to the other apps
2. Create one users table, figure out how to get ActiveRecord to do  
cross-database joins
3. Use LDAP ;^)

Thanks,

m

---

<div class="post-metadata">

**Author:** ![marcbey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@marcbey](https://www.ruby-forum.com/u/marcbey)\
**Post date:** [September 1, 2007, 12:39am UTC](https://www.ruby-forum.com/t/shared-users/113511/2 "2007-09-01T00:39:48Z")

</div>

> I have three RoR apps with the same users. It would be nice if they didn’t  
> have to create usernames and passwords for each…
> 
> What’s the best practice?
> 
> 1. Create one users table, replicate it to the other apps
> 2. Create one users table, figure out how to get ActiveRecord to do  
> cross-database joins
> 3. Use LDAP ;^)

1. Have a backend “auth” table that each of the front ends talk to.  
Only  
keep the bare minimum in that table and put all the app specific profile  
stuff in it’s own database.

Also, depending on how you’re using things you might not need to do  
anything. We’ve got a section of our site split out into another  
database. Only connection is that the the models for that section  
“:have\_one :user”.

It all just works as the queries tend to be: select \* from my\_models  
where  
user\_id = 123.

But I do have to remember i can’t do joins…

-philip

---

<div class="post-metadata">

**Author:** ![marcbey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@marcbey](https://www.ruby-forum.com/u/marcbey)\
**Post date:** [September 1, 2007, 2:17am UTC](https://www.ruby-forum.com/t/shared-users/113511/3 "2007-09-01T02:17:53Z")

</div>

Marc B. wrote:

> 1. Use LDAP ;^)  
> Why would you have to do a join in #2? I would create a separate  
> database with just the users table.

–  
Michael W.
