简体   繁体   中英

Disabling ActiveRecord in Ruby on Rails 5

I used the Disable ActiveRecord in Ruby on Rails 5 as a reference, but my problem was not solved.

I'm experiencing the problem below

Cannot load database configuration:
Could not load database configuration. No such file - ["config/database.yml"] (RuntimeError)

Do you know what to do?

If you creating new project then you can exclude ActiveRecord by running the command: rails new yourprojectname -O
where the -O param is used for not including ActiveRecord into newly created project.

For existing project please check this advise here: How do I remove ActiveRecord from an existing Rails 4 Application?

For Rails 5 there is one more suggestion to do: Do all the steps from link above, but also remove the line

Rails.application.config.active_record.belongs_to_required_by_default = true

from

config/initializers/new_framework_defaults.rb

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