Topic: How to silence ActiveRecord in favour of MongoDB

Hello every one,

I was playing around with MongoDB and love it and my favourite wrapper gem Mongroid. The only problem I am having is that Rails still insist on many levels that active record has some associative database even though I am not using it. Mongroid has a separate config file from database.yml and though everything works if rails doesn't find a connection to a database like mysql or sqllite it complains and crashes.

For a quick solution I just tell it to use sqllite and I doubt there is much of a performance issue involved in this. I would like to know how to completely override active record and tell rails to use mongroid instead and would love any help thank you.

Re: How to silence ActiveRecord in favour of MongoDB

Wow my bad every one the answer was right on mongroid.org in the configuration instructions. I am getting better at finding answers without resorting to forums just not totally there yet.

Now that you have a mongoid.yml you can't wait to delete that pesky database.yml, right? Do it and you'll start getting ActiveRecord errors all over the place. You don't need ActiveRecord unless you're trying to use Mongo in concert with a SQL database. Here's how you remove ActiveRecord from the most recent version of Rails 3...
Open myapp/config/application.rb and near the top, remove the line require 'rails/all' and add the following three lines so you end up with this:
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
# require "sprockets/railtie" # Uncomment this line for Rails 3.1+