How to skip active record for existing project in Rails 6

百般思念 提交于 2020-02-16 10:41:30

问题


I have an existing Rails project which I created in API mode, using no DB. Upon trying to deploy to Heroku, I am getting lots of ActiveRecord related errors.

-----> Detecting rake tasks
 !
 !     Could not detect rake tasks
 !     ensure you can run `$ bundle exec rake -P` against your app
 !     and using the production group of your Gemfile.
 !     rake aborted!
 !     URI::InvalidURIError: bad URI(is not URI?): ://user:pass@127.0.0.1/dbname
  ...
  ...
/activerecord-6.0.2.1/lib/active_record/railties/databases.rake

回答1:


To replicate the skip-active-record setup in an existing project, follow the steps in this answer

PLUS

REMOVE config/environments/development.rb -> config.active_storage.service = :local

REMOVE config/environments/production.rb -> config.active_storage.service = :local

REMOVE config/environments/test.rb -> config.active_storage.service = :local

REMOVE bin/setup -> puts "\n== Preparing database ==" system! 'bin/rails db:prepare'

DELETE config/storage.yml

REMOVE test/test_helper.rb # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all



来源:https://stackoverflow.com/questions/60041360/how-to-skip-active-record-for-existing-project-in-rails-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!