如何从现有的 Rails 4 应用程序中删除 ActiveRecord? [英] How do I remove ActiveRecord from an existing Rails 4 Application?

查看:18
本文介绍了如何从现有的 Rails 4 应用程序中删除 ActiveRecord?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始了一个 Ruby on Rails 项目,其中包括一个带有 ActiveRecord 和 Neography 的简单推荐系统.现在我发现了 neo4j.rb,它将大大简化我的生活.:-)

I started off a Ruby on Rails Project which includes a simple recommender system with ActiveRecord and Neography. Now I found out about neo4j.rb, which is going to simplify my life by a lot. :-)

我现在了解到,我可以创建一个没有 ActiveRecord 的新应用程序,如下所示:

I learned by now, that I could create a new Application without ActiveRecord as follows:

rails new xyz -O

我可以这样做并将我的大部分文件/代码复制粘贴到该新项目中.或者有更简单的方法吗?

I could do that and copy paste most of my files / code into that new project. Or is there an easier way?

我还在考虑这一步是否有必要.是否可以同时使用 neo4j.rb 和 ActiveRecord?我正在考虑在 Neo4j 中使用 ActiveRecord 和我的推荐系统运行身份验证系统(例如设计).有没有人有这种方法的经验?

I am still thinking about if that step is even necessary. Is it possible to use both neo4j.rb and ActiveRecord in parallel? I am thinking of running the authentication system (e.g. Devise) with ActiveRecord and my recommender system in neo4j. Does anyone have experiences with such an approach?

推荐答案

按照以下步骤操作

  1. 从您的 Gemfile 中删除数据库适配器 gem,例如 mysql2、sqlite3 等

  1. Remove database adapter gems from your Gemfile, e.g., mysql2, sqlite3, etc

application.rb 中删除 require 'rails/all' 和 require 框架(其中包括 可用 在您的 rails 版本中,列表有所不同,不要只是复制)你要使用的,例如:

From application.rb, remove require 'rails/all' and require frameworks (among those available in your rails version, the list varies, do not just copy) you want to use, for example:

require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"

  • 删除database.ymlschema.rb和所有迁移

    希望这有帮助!

    来源 - 为 Rails 4 禁用 ActiveRecord

    这篇关于如何从现有的 Rails 4 应用程序中删除 ActiveRecord?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆