Rails: disabling database access for rails app's

Posted on Monday, January 05, 2009 by Anuj Mehta

Rails is ruby based framework for creating web applications. The framework is based on MVC (Model, View and Control) architecture. Model is the module that provides easy access of database; Controller has logic and data flow intelligence while the View displays data on browser. While most of the applications are backed by database but there are scenarios where applications don’t need database for persisting data. For those applications we need to disable ActiveRecord. ActiveRecord is the class which accesses database. Below defined steps were performed on Rails 2.1.2

1. Add following line in environment.rb located in /config directory

  
config.frameworks -= [ :active_record ]

This line should come after following line
   
Rails::Initializer.run do |config|


2. Comment all the lines starting with ActiveRecord::Base in /config/initializers/new_rails_defaults.rb

0 Responses to "Rails: disabling database access for rails app's":