Rails 模型设计:提议和反提议时间
我有一个模型,允许用户 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你所描述的是一个状态机。
较旧的 SO 问题讨论当时的各种 gem 和插件,以及一些基础知识。
< a href="http://www.shopify.com/technology/3383012-why-developers-should-be-force-fed-state-machines" rel="nofollow noreferrer">较新的博客文章讨论了方法和原因。
What you're describing is a state machine.
Older SO question discussing the various gems and plugins of the time, plus some basics.
Newer blog post discussing the hows and whys.