Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging two rails apps

I have a main app and a forum app. I wanted to include forums in my main website. I manually copied all files from forum into my main app. I created proper routes and copied everything from db/migrate.

Now, I can see that everything is included and it works. But the problem is that whatever was originally stored in my forum apps that is questions and categories are no longer stored in the main app after merging. Its like a new copy.

Is there a better way to merge two rails apps along with stored data? or is there any way i can resolve this issue

like image 747
Wasi Avatar asked Aug 23 '11 14:08

Wasi


2 Answers

You can adapt your forum application as a mountable app, follow this tutorial. I think this could be the best way to do that.

Also you can read pointers in this my previous question to get a general idea on rails engines: Differences between railties and engines in Ruby On Rails 3

like image 109
Fabio Avatar answered Oct 01 '22 19:10

Fabio


Features like forums which are common across web apps can be built using engines which can be easily plugged into rails apps

If you want to share the data between 2 rails apps, you have to have a separate setting in database.yml and use establish_connection method inside the forums model in both the rails apps.

Click here to understand how to configure multiple databases in a rails application.

like image 27
Arun Kumar Arjunan Avatar answered Oct 01 '22 20:10

Arun Kumar Arjunan