Combining two rail applications

I have a main application and a forum application. I wanted to include forums on my main site. I manually copied all the files from the forum into the main application. I created the correct routes and copied everything from db / migrate.

Now I see that everything is up and running. But the problem is that everything that was originally saved in my forums, which are questions and categories, is no longer stored in the main application after the merge. It is like a new copy.

Is there a better way to combine two applications with rails along with saved data? or I can solve this problem.

+7
source share
3 answers

You can adapt your forum application as a mounted application, follow this tutorial . I think this may be the best way to do this.

You can also read the pointers in this my previous question to get a general idea of โ€‹โ€‹rails engines: Differences between Rails and Engines in Ruby On Rails 3

+6
source

Features such as forums that are common to web applications can be created using engines , which can be easily connected to rails applications.

If you want to share data between two rails applications, you must have a separate parameter in database.yml and use the establish_connection method inside the forum model in both rails applications.

Click here to understand how to set up multiple databases in the rails application.

+1
source

There you go: https://github.com/adamwiggins/yaml_db

Install plugin

 rake db:data:dump 

from the old database

 rake db:data:load 

into the new database. Voila!

0
source

All Articles