ruby on rails新項目不使用資料庫,配置過程記錄

來源:互聯網
上載者:User

標籤:

 

查詢了大神的經驗貼

http://stackoverflow.com/questions/19078044/disable-activerecord-for-rails-4

http://stackoverflow.com/questions/821251/how-to-configure-ruby-on-rails-with-no-database

其中點贊最多的也是我用的方法

If you are creating a new application, you can use -O to skip ActiveRecord:rails new my_app -OFor existing applications:1. Remove database adapter gems from your Gemfile (mysql2, sqlite3, etc.)2. Change your config/application.rbRemove require ‘rails/all line and require frameworks you want to use, for example:require "action_controller/railtie"require "action_mailer/railtie"require "sprockets/railtie"require "rails/test_unit/railtie"3. Delete your config/database.yml file, db/schema.rb and migrations (if any)4. Delete migration check in test/test_helper.rb5. Delete any ActiveRecord configuration from your config/environments files (this is what is causing your error)
這一步直接刪除environments裡所有的檔案This is all you need to do for an empty Rails app. If you run into problems caused by your existing code, stack trace should give you sufficient information on what you need to change. You might for example have some ActiveRecord configuration in your initializers.

6.刪除controller裡對Model的調用,把model裡對ActiveRecord的依賴也刪除

 

ruby on rails新項目不使用資料庫,配置過程記錄

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.