2

I am starting work on a large project in Rails 3. I want to build the app using both MySql and MongoDB. I already know how to use Rails with MySql, and have found a lot of info about using MongoDB and rails. But what I have not been able to find is any good information on using both MySql and MongoDB together. I was looking at the Mongoid project, and thought it would be good to use, thought I don't know if it is the best solution.

On the Mongoid site under the Installation/Configuration section it talks about using both Mongoid and ActiveRecord together, but it does not explain how.

So, I was hoping someone could tell me either how to set Mongoid and ActiveRecord to work together, or a better solution all together.

Terry Finn
  • 21
  • 2
  • 1
    Did you google? Cause I just did and a bunch of sites came up w/ examples. – sdot257 Jul 27 '11 at 14:17
  • Yes I googled, I found lots of stuff too, but none of it explained how to get ActiveRecord and Mongoid to work together. If you would like to share what exactly you searched for, that would be great. – Terry Finn Jul 27 '11 at 14:38
  • http://stackoverflow.com/questions/5411283/rails-3-how-to-use-active-record-and-mongoid-at-the-same-time http://stackoverflow.com/questions/6540500/how-can-i-use-mongoid-and-activerecord-in-parallel-in-rails-3 – sdot257 Jul 27 '11 at 14:45
  • I have already seen them, and id not find either very helpful. – Terry Finn Jul 27 '11 at 15:13

1 Answers1

5

With all the previous suggestions also just add few more lines in your application

In application.rb add

config.generators do |g|
  g.orm :active_record
end

This should do the trick and run mongoid and mysql parallely

Pritesh Jain
  • 9,106
  • 4
  • 37
  • 51