Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:23:57+00:00 2026-06-07T04:23:57+00:00

We have a Rails 3 application with a PostgreSQL database (with ~10 tables) mapped

  • 0

We have a Rails 3 application with a PostgreSQL database (with ~10 tables) mapped by activerecord. Everything’s working fine.

However, we could also like to use:

  • a MongoDB database in order to store images (probably with mongoid gem).
  • a Neo4j database (probably with neo4j-rails gem) instead of PostgreSQL for some tables.

Using a database with one Rails ORM is simple, thanks to database.yml. But when there’s more than one ORM, how can we process? Is there a good way to do so? For instance, ActiveHash (and ActiveYaml) can work well with ActiveRecord. I think there could be a possibility to let differents ORM working together. Thanks for any tips.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:23:58+00:00Added an answer on June 7, 2026 at 4:23 am

    This really depends on the type of ORM. A great way to do this is by using inheritance. For example you can have multiple databases and adapters defined in your database.yml file. You can easily talk to these using the ActiveRecord establish_connection method.

    # A typical Active record class
    class Account < ActiveRecord::Base
      ...
    end
    
    # A new database connection
    class NewConnection < ActiveRecord::Base
      self.abstract_class = true
      establish_connection "users_database"
    end
    
    # A new Active record class using the new connection
    class User < NewConnection
      ...
    end
    

    The only down side here is that when you are connection to multiple active record databases migrations can get a little bit dicey.

    Mixing ORM’s

    Mixing ORMS is easy. for example mongodb (with mongoid), simply dont inherit from active record and include the following in the model you want to use mongo:

    class Vehicle
      include Mongoid::Document
    
      field :type
      field :name
    
      has_many :drivers
      belongs_to :account
    
    end
    

    ORMs built on top of active model play very nicely together. For example with mongoid you should be able to define relations to ActiveRecord models, this means you can not only have multiple databases but they can easy communicate via active model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I working on Ruby on Rails application using a PostgreSQL database. I have heard
I have a Ruby on Rails application with a PostgreSQL database; several tables have
I am thinking of working on a Rails application that uses PostgreSQL. I have
I have a PostgreSQL database for my Rails application. In the schema named 'public'
I have a PostgreSQL database for a Rails application. I want to store the
I have wrote a few simple Rails application, accessing the database via the ActiveRecord
I'm working on rails application with postgres db.I have a table called merchant_review_votes where
I have a rails application, running in development mode ( with a sqlite database
I have a Rails application that right now is pretty standard: Heroku/PostgreSQL backend, users
I have Rails application (Redmine) and I have created next working code which close

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.