Is Ruby on Rails suitable for apps that need to connect to more than one database (i.e. more than one data source) or apps that are database independent (i.e. can work with PostgreSQL, SQL Server, Oracle, etc.)?
-
In my opinion while it is possible to build one Ruby on Rails app in which some models connect to DB1 and some to DB2 by monkey patching ActiveRecord and invoking establish_connection, RoR is not designed for suchlike use cases and another framework should be chosen for suchlike apps. Another question I've is if RoR is suitable for apps that need to connect both to a NoSQL (e.g. MongoDB) and relational database at the same time? Finally, as the query language of ActiveRecord is not 100% database agnostic (e.g. compared to Java Persistence API's JPQL and Hibernate's HQL), I think RoR is not suitable for apps that need to support different RDBMS types. What do you think? Are my assumptions and observations correct?
-
Answer:
You should take a look at this gem https://github.com/tchandy/octopus, it allows you to connect to multiple databases, even with different adapters. I don't think you'll get any problems using AR and NoSQL gem like Mongoid at the same time, each model will inherit from the right class. I want to say that Rails is 100% database agnostic if you use AR right, but I can't be really sure because, in older versions of Rails I got some inconsistency between adapter but I think this has improved a lot in the last releases.
Igor Bozato at Quora Visit the source
Related Q & A:
- If I would like to close one of two e-mail addresses with yahoo would that be possible?Best solution by Yahoo! Answers
- How do I import contacts from one e-mail address to another?Best solution by support.google.com
- Why can't I receive-mail from one particular e-mail address?Best solution by Yahoo! Answers
- What do I need to connect my iPod touch 2nd gen to the AUX port in my Vauxhall Corsa D?Best solution by Yahoo! Answers
- I need a nice, comfortable, and spacious backpack . Anyone know of a good one.Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.