Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add ActiveRecord to a rails app initialized without ActiveRecord?

I created a rails app with the -O option (i.e. without ActiveRecord). But now I want to add active record to it. How can I accomplish that?

like image 431
Coffee Bite Avatar asked Mar 15 '12 04:03

Coffee Bite


1 Answers

Inside of config/application.rb you should see where the ActiveRecord railtie is commented out (see below).

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

Uncomment it.

Also make sure to add a database.yml file and the a database adapter gem (e.g. sqlite3) to your Gemfile.

like image 104
Carlos Ramirez III Avatar answered Sep 21 '22 12:09

Carlos Ramirez III