简体   繁体   English

将ActiveRecord模型与版本以及它们与版本的关联存储的最佳方法是什么?

[英]What's the best way to store the ActiveRecord Models with Versions and their Associations with Versions?

If all I have is one model (for example Wiki) and want to save it along with its versions, I could use acts_as_versioned plugin which stores the wikis in "wikis" table and its versions in "wikis_versions" table. 如果我只有一个模型(例如Wiki),并且想要将其连同版本一起保存,则可以使用acts_as_versioned插件,该插件将wiki存储在“ wikis”表中,并将其版本存储在“ wikis_versions”表中。 This is plain an simple even if I want to moderate the latest version before showing it to the public using a field as status with "pending review/ published". 即使我想先审核最新版本,再使用带有“待审核/已发布”状态的字段向公众展示最新版本,这也很简单。

What's the best way to handle Wiki with associations (for example attachments, assets,..) which also have versions? 使用具有版本的关联(例如附件,资产等)处理Wiki的最佳方法是什么? And how would you moderate it? 而且您将如何审核? Do you create a new version to wiki even though only its association is changed just to keep the flow going, if so what about other associations? 您是否为Wiki创建了一个新版本,即使仅更改了它的关联只是为了保持流程的正常进行,如果这样,其他关联又如何呢?

What's the best way to handle it with little db overhead? 用很少的数据库开销来处理它的最佳方法是什么?

Thanks in advance. 提前致谢。

I have used both acts_as_versioned and acts_as_audited. 我已经使用了act_as_versioned和act_as_audited。

I prefer the latter because it uses a single table. 我更喜欢后者,因为它使用单个表。 Using acts_as_versioned we've had issues with changes to versioned tables requiring extra migrations => this adds extra complexity to our build and deployment process. 使用acts_as_versioned,我们遇到了版本表更改方面的问题,需要额外的迁移=>这为我们的构建和部署过程增加了额外的复杂性。

Richard Livsey has a nice plugin for this that works with acts_as_versioned. 理查德·利夫西(Richard Livsey)为此提供了一个不错的插件,可与acts_as_versioned一起使用。

http://github.com/rlivsey/acts_as_versioned_association/tree/master http://github.com/rlivsey/acts_as_versioned_association/tree/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在表的特定列上跟踪版本的最佳方法是什么? - What's the best way to track versions on a specific column of a table? 列出所有paper_trail版本(包括关联)的正确方法是什么? - What's the right way to list all paper_trail versions including associations? 在memcached中存储ActiveRecord对象的最佳方法是什么? - What is the best way to store an ActiveRecord object in memcached? 对这些数据库关联进行建模的最佳方法是什么? - What's the best way to model these database associations? 在ActiveRecord模型和观察者中访问路径的最佳方法是什么 - What is the best way of accessing routes in ActiveRecord models and observers 适应插件的“两个”版本的最佳/最清晰的解决方案是什么 - What's the best/clearest solution to adapt “two” versions of a plugin ActiveRecord模型中的复杂关联 - Complex associations in ActiveRecord models 将本地gem版本与“外面的”版本进行比较的最快方法? - Quickest way to compare local gem versions to what's 'out there'? 建立这些复杂模型关联的最佳方法是什么? - What's the best way of setting up these complicated model associations? 有条件覆盖ActiveRecord删除机制的最佳方法是什么? - What's the best way to conditionally override ActiveRecord's deletion mechanism?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM