# Combining different Rails apps into one

**URL:** <https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232>\
**Category:** Rails\
**Created:** [March 18, 2008, 5:38am UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232 "2008-03-18T05:38:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 18, 2008, 5:38am UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/1 "2008-03-18T05:38:39Z")

</div>

Hello!

I’m trying to join two Rails apps, namely Beast and Simplelog.

Is it just to copy the code from one app into the other, and manually  
merge conflicting files and folders?

Can anybody offer me some tips and tricks on this?

I see a lot of pain, for instance, when it’s time to upgrade…

[http://forums.simplelog.net/comments.php?DiscussionID=98&page=1](http://forums.simplelog.net/comments.php?DiscussionID=98&page=1)

It is important that things remain neat and supersimple, otherwise I’ll  
feel sick.

Thanks,  
Kyrre

---

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 18, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/2 "2008-03-18T15:37:40Z")

</div>

Kyrre Nygård wrote:

> Hello!

Hi there.

> I’m trying to join two Rails apps, namely Beast and Simplelog.

Alright…

> It is important that things remain neat and supersimple, otherwise I’ll  
> feel sick.

Impossible.

I’m not quite sure what exactly you want to achieve (single sign on,  
single database, single codebase or a combination) but none of these is  
supersimple probably also won’t be neat.

Having a single database would be the easiest one (besides SSO if the  
apps support openid out of the box). You would have to compare the  
tables created by both apps to make sure that there are no duplicates.  
Then it would be as simple as pointing both configs to the same db. The  
only thing that will break is migrations support since the schema  
version is stored in the db as well. You can always go in and manually  
edit the schema version number though… If there are duplicate table  
names, you would need obviously need to override them.

Now if you would REALLY want to merge codebase and have a single  
database, the way to go might be to namespace all your ruby classes into  
e.g. Beast and Simplelog. Then you create a Application::Base \<  
ActiveRecord::Base class for each app and use this base class to prefix  
all your tables with e.g. beast\_ or simplelog\_. Of course you then have  
to go prefix your routes as well.

I’ve never looked at the codebase of these applications but in theory  
this would be a fairly low-mess approach, even upgrades should be  
relatively painless if all you’ve done is prefix your routes and  
introduce a new base class for all models. Clearly though, YMMV and of  
course the question remains: why?

Regards,  
Niels

---

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 18, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/3 "2008-03-18T16:02:05Z")

</div>

Niels,  
For what it’s worth I had the same need and found it much easier to  
‘reverse engineer’ these types of apps and then rebuild them myself.  
You can see what I did at [www.RailsExpert.com](http://www.RailsExpert.com).  
Kathleen

---

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 19, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/4 "2008-03-19T21:59:39Z")

</div>

Kyrre Nygård wrote:

> Indeed I am looking for a single sign on, a single database as well as a  
> single codebase.
> 
> One of the apps comes with OpenID support, the other, no.

Well, you can always politely ask for inclusion of OpenID support in the  
other app.

As pointed out earlier, “namespacing” your database tables should be  
_fairly_ trivial (although you have to take care with your migrations,  
e.g. all migration files also need to be changed to include table name  
prefixes).

Contrary though, I wouldn’t even try to merge codebases since this will  
most likely turn into a complete mess at the latest when updating. It is  
called “application” (as opposed to e.g. component) for a reason…

> That’s a nice domain by the way. Did you have to travel to Morocco just  
> to get it?

Nope. They give them out just like that. Well in exchange for your  
credit card information that is… 🙂

Cheers,  
Niels

---

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 19, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/5 "2008-03-19T17:35:57Z")

</div>

Indeed I am looking for a single sign on, a single database as well as a  
single codebase.

One of the apps comes with OpenID support, the other, no.

That’s a nice domain by the way. Did you have to travel to Morocco just  
to get it?

Kyrre

----- Original Message -----  
From: Niels G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Tuesday, March 18, 2008 10:36 pm  
Subject: [Rails] Re: Combining different Rails apps into one  
To: removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSKyrre\_NygSSSSrdSS](https://www.ruby-forum.com/u/SSKyrre_NygSSSSrdSS)\
**Post date:** [March 19, 2008, 10:22pm UTC](https://www.ruby-forum.com/t/combining-different-rails-apps-into-one/132232/6 "2008-03-19T22:22:01Z")

</div>

The way you put it does sound quite trivial, and I’m really gonna put my  
heart into this.

As for upgrading, yeah I’ll most likely have to do this manually.

I was just about to write the following to the Git mailing list:

–

Has anybody ever written a script that keeps track of your favorite Git  
and SVN projects? E.g. sends you an e-mail every time a revision has  
been made, with details like the summary, time and date, author and code  
differences.

I’ve modified a few projects to my liking, so much that any change made  
to the original would have to be added manually. I also think it would  
be a great way to learn.

I can’t imagine anything better than a neat little Ruby script stacked  
inside my crontab. I’m still a rookie though, otherwise I’d have made my  
own already.

–

If you know of anything like this, please let me know.

Kyrre

----- Original Message -----  
From: Niels G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Thursday, March 20, 2008 4:58 am  
Subject: [Rails] Re: Combining different Rails apps into one  
To: removed\_email\_address@domain.invalid
