3

Can we start (or) run a rails application without any database?

How can I do it?

Jonathan Soifer
  • 2,715
  • 6
  • 27
  • 50
Kranthi
  • 1,377
  • 1
  • 17
  • 34

2 Answers2

4

At the beginning of your config/application.rb file you should have something like this:

require File.expand_path('../boot', __FILE__)

# 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"

When you remove this line:

require "active_record/railtie"

ActiveRecord will be gone and your app won't require a database connection.

You can also create the project with --skip-activerecord if it's a new one.

Maurício Linhares
  • 39,901
  • 14
  • 121
  • 158
-1

Check this link Rails 3 - how do I avoid database altogether?.

You just need to make sure in configuration that the database related classes are not in use. There might be more help on web.

Community
  • 1
  • 1
Samiron
  • 5,169
  • 2
  • 28
  • 55
  • Though @Linhares answered in a very brief and clear way, I think this link provides more comprehensive answer to this question. However, thnx :) – Samiron Sep 21 '12 at 02:28