Rails 模型设计:提议和反提议时间

发布于 2024-12-10 18:36:40 字数 164 浏览 3 评论 0原文

我有一个模型,允许用户 A 向用户 B 提议约会时间。如果 B 接受,则设置事件。但如果 B 提出另一个时间,那么 A 必须接受或提出另一个时间,依此类推。在一位用户接受另一位用户的反建议之前,不会设置约会。

我应该如何对这种来回提案进行建模并跟踪 Rails 的当前阶段?

谢谢。

I have a model that allows user A to propose a time for an appointment to user B. If B accepts, then event is set. But if B proposes another time, then A must accept or propose another time, and so on. Until one user accept the other's counter-proposal, the appointment won't be set.

How should I model this kind of back and forth proposals and to keep track of current stage in Rails?

Thank you.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

﹏半生如梦愿梦如真 2024-12-17 18:36:40

你所描述的是一个状态机。

较旧的 SO 问题讨论当时的各种 gem 和插件,以及一些基础知识。

< a href="http://www.shopify.com/technology/3383012-why-developers-should-be-force-fed-state-machines" rel="nofollow noreferrer">较新的博客文章讨论了方法和原因。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文