ruby on rails新项目不使用数据库,配置过程记录
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ruby on rails新项目不使用数据库,配置过程记录,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1304字,纯文字阅读大概需要2分钟。
内容图文
查询了大神的经验贴
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 -O For existing applications: 1. Remove database adapter gems from your Gemfile (mysql2, sqlite3, etc.) 2. Change your config/application.rb Remove 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.rb 5. 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的依赖也删除
原文:http://www.cnblogs.com/iwangzheng/p/4820298.html
内容总结
以上是互联网集市为您收集整理的ruby on rails新项目不使用数据库,配置过程记录全部内容,希望文章能够帮你解决ruby on rails新项目不使用数据库,配置过程记录所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。