复杂应用程序的数据建模:继承?模块?

发布于 2024-11-05 13:01:01 字数 662 浏览 0 评论 0原文

我正在为 Rails 应用程序开发一个原型,该应用程序的模型有些复杂。我很难弄清楚应该如何设计模型。

基本思想如下:

假设该应用程序适用于小型合作社,并且应该允许用户在线提交“申请”(如申请贷款、账户等)。

从技术上讲,它们都是“应用程序”,我的客户想要一个仪表板,显示给定组(即:汽车贷款组)的所有待处理评估。所以,我正在考虑建立一个应用程序模型。我可以为贷款、帐户等子类化 ApplicationModel ,但我认为 Rails 将使用 Loans 表、Accounts 表,以及对于每种类型的模型都是如此。贷款也有不同种类:抵押贷款、汽车贷款、个人贷款等。所有贷款都需要不同的数据。整个贷款部门的经理应该能够从他的仪表板(所有类别的贷款)中查看所有待审批的贷款审批。

如果我要做类似 Loans.find() 的事情,我会得到所有贷款子类型吗?或者仅存储在贷款表中的内容?

继承是一条出路吗?我应该看别的东西吗? Rails 足以满足这种应用吗?

我看到他们正在使用的基于 Java 构建的遗留应用程序(但非常讨厌)。以前的开发人员有一个 ST_APPLICATIONS 表,用于存储所有应用程序。在该表中,他将所有应用程序数据存储在包含一堆 XML 的 blob 中。 Rails 会推荐这种方法吗?

I'm developing a prototype for a Rails application that has a somewhat complex model. I'm having a hard time figuring out how the model should be designed.

Here's the basic idea:

Say the app is for a small coop, and should allow users to file "applications" (as in a apply for a loan, accounts, etc) online.

Technically, all of them are "applications" and my client would like a dashboard presenting all pending evaluations for a given group (ie: the auto loans group). So, I'm thinking of having an application model. I could subclass ApplicationModel for loans, accounts, etc., but I'm thinking Rails will use a Loans table, an Accounts table, and so, and so for each type of model. There are different kinds of loans too: Mortgage, Auto, Personal, etc. All require different data. A manager for the whole Loans division, should be able to see all pending loan approvals from his dashboard (all classes of loans).

If I were to do something like Loans.find() would I get all Loan subtypes with it? Or only what's stored in the loans table?

Is inheritance the way to go? Should I be looking at something else? Is rails even adequate for this kind of application?

I saw the legacy application built on Java that they were using (but hated with a passion). The previous developer had an ST_APPLICATIONS table which store all applications. In that table he stores all the application data in a blob containing a bunch of XML. Would such an approach be recommended with Rails?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文