使用 Ruby on Rails 实现预订系统 [英] Implementing Reservation System Using Ruby on Rails

查看:19
本文介绍了使用 Ruby on Rails 实现预订系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搭建一个餐厅预订系统,功能如下:

Build a restaurant reservation system with the following function:

以下是优先功能列表:

  • 可以设置桌数(假设每桌有 4 个座位)
  • 可以查看当前预订,
  • 超过 2 小时的预订将被自动清除
  • 可以添加在指定日期/时间通过电话完成的预订
  • 可以删除预订
  • 可以更新通过电话完成的预订
  • 可以查看当天/时间的可用表数量
  • 可以添加日期/时间的预订,获取确认号码
  • 可以使用确认号码取消预订
  • 可以使用确认号码更新预订

我对 ruby​​ on rails 完全陌生,我只需要一个简单的提示,说明如何开始以及我应该如何解决这个问题?

I am completely new to ruby on rails, I just need a simple hint on how to get started and what should be my approach for this problem?

推荐答案

首先定义模型(实体)、它们的属性以及它们如何相互关联.接下来,弄清楚需要向前端公开哪些功能.

Start by defining the models (entities), their properties, and how they relate to each other. Next, figure out what functionality needs to be exposed to the front end.

(这些步骤可以按任意顺序发生,或者更现实地说,每个步骤都会影响您对另一个的想法,因此当您迭代系统必须处理的各种事情时,它会来回反弹.)

(Those steps can occur in either order, or, more realistically, each will affect your thoughts about the other, so it bounces back and forth as you iterate over the various things the system must handle.)

使用您将遇到的条件以及您如何知道它已完成,扩展您在上面的用户故事.Rails 使开始构建初步功能变得容易——不要一开始就纠结于它的外观,只要确保你确实可以做你需要做的事情.

Expand the user stories you have above with conditions you'll encounter and how you'll know it's done. Rails makes it easy to get starting building up preliminary functionality--don't get hung up with how it looks at first, just make sure you can actually do what you need to.

您还需要一个用户身份验证/授权系统;我建议使用现有的,例如 authlogic设计.我不知道你是否需要像 cancan 这样的授权;但是你需要某种方法来确保人们只能看到他们应该能够看到的东西.

You'll also need a user authentication/authorization system; I recommend using an existing one like authlogic or devise. Whether or not you need something like cancan for authorization I don't know; but you'll need some way of making sure people can only see what they're supposed to be able to.

您还需要像 eventmachine 之类的东西来清除旧的预订(伙计,在纽约,如果您喜欢迟到 10 分钟,你要离开了!)但是一步一步来——首先只是将清扫器作为一个手动过程来实现,以解决逻辑问题.

You'll also need something like eventmachine for sweeping away old reservations (man, in NYC if you're like 10 minutes late, you're outta there!) but take things a step at a time--first just implement the sweeper as a manual process to get the logic worked out.

祝你好运!

这篇关于使用 Ruby on Rails 实现预订系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆