简体   繁体   中英

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

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

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 (eg sqlite3 ) to your Gemfile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM