Saturday, May 31, 2008

Setting up a Rails 2.0 Project without a Database

I needed to create a Rails application that wasn't going to use a database backend. In my case I was going to be using REST services to access the data, so I had no need for database integration. I search around and found bits and pieces of information related to this but the following is what ended up working for me.

Add the following line (actually just uncomment out) to: \config\environment.rb
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

Delete \config\database.yml

Comment out the following in \config\initializers\new_rails_defaults.rb
# Only save the attributes that have changed since the record was loaded.
#ActiveRecord::Base.partial_updates = true

# Include ActiveRecord class name as root for JSON serialized output.
#ActiveRecord::Base.include_root_in_json = true

# Use ISO 8601 format for JSON serialized times and dates
#ActiveSupport.use_standard_json_time_format = true

That's it...