Ruby on Rails 中模型的版本控制 [英] Versioning of Models in Ruby on Rails

查看:49
本文介绍了Ruby on Rails 中模型的版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个插件/行为来允许对我的模型进行版本控制.找到可用解决方案的列表有点困难.到目前为止,我收集了:

I'm looking for a plugin/act to allow versioning of my models. It's kind of difficult to find a list of the available solutions. So far I gathered:

  • acts_as_versioned
  • simply_versioned
  • vestal_versions

最后两个解决方案只需要一个单一的版本表 - 这听起来不错,但我对迁移的难易度将如何受到影响有一种不好的感觉(因为它们将状态序列化为一个字符串).

The last two solutions only require a single version table - this sounds nice, but I've got a bad feeling about how the ease of migrations will be affacted by this (because they serialize states as a string).

另一方面,acts_as_versioned 有点脏(最后一次提交是在一月份).最近是否有任何这些方面的经验?或者我可能忽略的其他解决方案(或分支)?

On the other hand, acts_as_versioned is a little bit dusty (last commit in January). Are there any recent experiences with any of these? Or other solutions (or forks) I might have overlooked?

推荐答案

我上周与 vestal_versions 合作,是的,它是最先进的替代方案,至少在空间方面:你只存储您真正需要的东西.这是一个活跃的项目,1.0 版将是一个包含许多新功能的巨大更新;看看 1.0 分支就知道我的意思了.

I've worked with vestal_versions last week and yes, it is the most advanced alternative, at least in terms of space: you store just what you really need. It is an active project and the version 1.0 is going to be a huge update with many new features; just look at the 1.0 branch to know what I mean.

但是在玩了一会儿之后,我发现了一个很大的缺陷:性能.每次需要特定版本时,都必须遍历所有中间版本,重新构建所需的版本.这也意味着您不能直接编辑或删除版本,因为它可能会干扰修改,破坏链条.为此,您需要充分处理版本,而 vestal_versions 目前还没有做到这一点.

But after playing with it a bit, I've noticed a big flaw: performance. Every time you need an specific version, you have to go through all intermediate ones, reconstructing the version you need. This also means you cannot edit or delete a version directly, because it can mess with modifications, broking the chain. For do this, you need to process versions adequately, what vestal_versions currently does not do.

这样,对于我遇到的问题,我最终得到了自己的版本控制解决方案.我需要性能以及快速删除和编辑版本的能力,所以我牺牲了存储空间并开发了类似于 act_as_versioned 的东西.

This way, for the problem I had, I ended up with my own versioning solution. I needed performance and the ability to delete and edit versions rapidly, so I sacrificed storage and developed something similiar to act_as_versioned.

但是,如果您不需要这个并且不必非常频繁地恢复,我强烈推荐 vestal_versions.这是一个先进、可靠且活跃的解决方案,背后有一位热情的开发人员.

BUT, if you don't need this and do not have to revert very frequently, I highly recommend vestal_versions. It is an advanced, solid solution and an active one, with a passionate developer behind it.

这篇关于Ruby on Rails 中模型的版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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