# Sharing a database

**URL:** <https://discuss.rubyonrails.org/t/sharing-a-database/22033>\
**Category:** rubyonrails-talk\
**Created:** [December 20, 2007, 4:04pm UTC](https://discuss.rubyonrails.org/t/sharing-a-database/22033 "2007-12-20T16:04:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Spooner](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@Jonathan\_Spooner](https://discuss.rubyonrails.org/u/Jonathan_Spooner)\
**Post date:** [December 20, 2007, 4:04pm UTC](https://discuss.rubyonrails.org/t/sharing-a-database/22033/1 "2007-12-20T16:04:32Z")

</div>

Hi,

I’m creating two rails applications lets call them appA and appB. They will each be running on a subdomin like [appA.domin.com](http://appA.domin.com).

I need a way to share the User table so the login/passwords will work of both. I’d also like to keep the app DRY and not have to repeat the Account Controller in each app. My first thought was to create a 3rd application and subdomin for account stuff only. So it would be [account.domin.com](http://account.domin.com) and each application would use its User table.

What do you think? Has anyone had the same problem?

Thanks, Jonathan Spooner

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 20, 2007, 4:14pm UTC](https://discuss.rubyonrails.org/t/sharing-a-database/22033/2 "2007-12-20T16:14:18Z")

</div>

We had a similar situation and ended up going down the route of having a 3rd authentication application.

Fred

---

<div class="post-metadata">

**Author:** ![Peter\_De\_Berdt](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Peter\_De\_Berdt](https://discuss.rubyonrails.org/u/Peter_De_Berdt)\
**Post date:** [December 20, 2007, 4:25pm UTC](https://discuss.rubyonrails.org/t/sharing-a-database/22033/3 "2007-12-20T16:25:20Z")

</div>

Either openid or activeresource (and indeed a third application) could do the job here.

Best regards

Peter De Berdt
