Disable active record in Rails 2.1.0

I've had a bit of trouble trying to disable active record in my rails app today.  I set the following in environment.rb as I had done before in rails 2.0.2:

  1. config.frameworks -= [ :active_record ]

However it resulted in the following error:

  1. vendor/rails/activesupport/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError)

The problem is that [your app]/config/initializers/new_rails_defaults.rb should check to see if ActiveRecord is enabled before it references it. A patch for this has already been checked into the rails codebase but if you don't want to wait for the next release you can get the patch from the link below and apply it yourself:


I made the mistake of applying this patch directly to rails/railties/configs/initializers/new_rails_defaults.rb as the patch does and wondered then why the fix didn't work. It would work for any new rails apps that you create but you'll need to apply it to config/initializers/new_rails_defaults.rb in your rails app in order for this to work.