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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With