1

我试图弄清楚何时应将“文本条目”存储在数据库中与作为静态文件存储的截止时间。这里有什么经验法则吗?文本条目最多有几个段落,并具有指向图像和表格的链接(以及指向其他文本条目的超链接)。文本输入的一些标准:

  1. 我正在考虑使用 DITA 作为内容格式
  2. 文本应该是可搜索的
  3. 如果文本被修改,将创建一个新版本

在此先感谢,查克

4

2 回答 2

0

“rails 方式”将使用数据库。

该解决方案将更具可扩展性,因此更快并且可能更容易开发(使用迁移等)。使用文件系统,您将不得不自己构建许多功能,这些功能已经为数据库使用而实现。

您可以创建一个模型(例如)文档并轻松使用现有的版本控制系统,例如paper_trail。使用索引搜索时,您可以只拥有一个 has_many 关系,使您能够实现模型之间的依赖关系(破坏模型意味着破坏搜索索引)。

于 2011-03-26T15:11:35.677 回答
0

Rather than a cut-off, you could look at what databases provide and ask yourself if those features would be useful. Take Isolation (the I in ACID): if you have any worries that multiple people could be trying to edit an entry at the same time, a database would handle that well while you'd have to handle the locks yourself working with files. Or Atomicity: you might want to update two things at once (e.g. an index page and an entry page) and know they will either both succeed or both fail.

Databases do a number of things beyond ACID, such as taking advantage of multiple datatypes, making querying easier, and allowing for scaling. It's a question worth asking since most databases end up having data stored in a bunch of files on disk. Would you end up writing a mini-database if you used files yourself?

Besides, if you're using rails you mind as well take advantage of its ActiveRecord functionality, and make it possible to use the many plugins that expect a database.

I'd use a database for even a small, single user rails app.

于 2011-03-26T15:44:04.700 回答