Disable database in Rails3?

You used to be able to disable the database for simple apps by putting:

config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

in the config/environments.rb file..

How do you do this in rails3?

I see this in the top of config/application.rb

Pick the frameworks you want:

require “active_record/railtie” require “action_controller/railtie”

require “action_mailer/railtie” require “active_resource/railtie” require “sprockets/railtie”

require “rails/test_unit/railtie”

So, you might experiment with commenting out the

require “active_record/railtie”


On a fresh 3.2.1 project, created as such

$ rails new -T -d postgresql

I commented out require rails/test_unit/railtie

I was able to pass rake environment with these changes:

diff --git a/config/application.rb b/config/application.rb index 2ebdbfb…5253dbe 100644 — a/config/application.rb +++ b/config/application.rb @@ -1,7 +1,7 @@ require File.expand_path(‘…/boot’, FILE)

Pick the frameworks you want:

-require “active_record/railtie” +# require “active_record/railtie” require “action_controller/railtie” … diff --git a/config/environments/development.rb b/config/environments/development.rb

index f14d681…6b1fafa 100644 — a/config/environments/development.rb +++ b/config/environments/development.rb @@ -23,11 +23,11 @@ New::Application.configure do config.action_dispatch.best_standards_support = :builtin

Raise exception on mass assignment protection for Active Record models

  • config.active_record.mass_assignment_sanitizer = :strict +# config.active_record.mass_assignment_sanitizer = :strict

    Log the query plan for queries taking more than this (works

    with SQLite, MySQL, and PostgreSQL)

  • config.active_record.auto_explain_threshold_in_seconds = 0.5 +# config.active_record.auto_explain_threshold_in_seconds = 0.5