# Models on existing database?

**URL:** <https://www.ruby-forum.com/t/models-on-existing-database/181362>\
**Category:** Rails\
**Created:** [January 10, 2010, 9:03pm UTC](https://www.ruby-forum.com/t/models-on-existing-database/181362 "2010-01-10T21:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rorra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rorra](https://www.ruby-forum.com/u/rorra)\
**Post date:** [January 10, 2010, 9:03pm UTC](https://www.ruby-forum.com/t/models-on-existing-database/181362/1 "2010-01-10T21:03:00Z")

</div>

Hey there,

Let’s say you have a simple application, that already have a users table  
and  
you want to re-use that on a different app.

How do you work with that?

[]'s  
Rodrigo D.

---

<div class="post-metadata">

**Author:** ![rorra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rorra](https://www.ruby-forum.com/u/rorra)\
**Post date:** [January 10, 2010, 9:08pm UTC](https://www.ruby-forum.com/t/models-on-existing-database/181362/2 "2010-01-10T21:08:51Z")

</div>

Hi Rodrigo,

On Sun, 2010-01-10 at 18:01 -0200, Rodrigo D. wrote:

> Hey there,
> 
> Let’s say you have a simple application, that already have a users  
> table and you want to re-use that on a different app.
> 
> How do you work with that?

As long as the database is (one of) the ones specified in database.yml,  
all you need to do is create the model in your new app.

HTH,  
Bill

---

<div class="post-metadata">

**Author:** ![rorra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rorra](https://www.ruby-forum.com/u/rorra)\
**Post date:** [January 10, 2010, 10:53pm UTC](https://www.ruby-forum.com/t/models-on-existing-database/181362/3 "2010-01-10T22:53:00Z")

</div>

Hmm… ok.

What about if you want to use multiple databases in your app?

[]'s  
Rodrigo D.

---

<div class="post-metadata">

**Author:** ![rorra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rorra](https://www.ruby-forum.com/u/rorra)\
**Post date:** [January 10, 2010, 11:37pm UTC](https://www.ruby-forum.com/t/models-on-existing-database/181362/4 "2010-01-10T23:37:29Z")

</div>

On Sun, 2010-01-10 at 19:51 -0200, Rodrigo D. wrote:

> Hmm… ok.
> 
> What about if you want to use multiple databases in your app?

Google is a Rails developer’s best friend. The solution you’re looking  
for depends a lot on how you want to manage your connections.

Googling ‘rails multiple databases in database.yml’  
[http://www.google.com/search?q=rails+multiple+databases+in](http://www.google.com/search?q=rails+multiple+databases+in)  
+database.yml&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a

Googling ‘rails multiple database connections’

> **[Google](https://www.google.com/search?hl=en&client=firefox-a&rls=com.ubuntu%25)**
>
> Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.

3Aen-US%3Aunofficial&hs=uEm&q=rails+multiple+database  
+connections&btnG=Search&aq=f&oq=&aqi=

HTH,  
Bill
