Hexa's Blog

Disable active record (nodatabase uses) in Rails 4

27/01/2015 Ruby on Rails 4

This article shows a quick tweak to unuse database gem, disable active record in Ruby on Rails 4.x

1. For new projects, run the following command to generate new project

rails new YourProject --skip-active-record

2. For existing projects

  • Edit file config/application.rb, remove require 'rails/all' and add:
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
  • Edit file /config/environment/development.rb, remove the following line:
config.active_record.migration_error = :page_load
  • Remove gem named sqlite3 in Gemfile
  • Delete or Comment (recommend) database.yml, db/schema.rb
  • Delete configuration in files in config/environments directory