如何在rails中为预订系统添加预订

时间:2013-08-11 19:11:03

标签: ruby-on-rails relation

你好我试图用一个简单的预订系统制作一个餐厅网站,用于桌子上的红宝石(V。:3.2.13)。 我有3个表:客户(姓名,电子邮件),预订(table_id,customer_id),表格(座位,区域)。

我已经配置了以下模型:

class Reservation < ActiveRecord::Base
  belongs_to :customer
  belongs_to :table
end

class Customer < ActiveRecord::Base
  has_many :reservations
  has_many :tables, :through => :reservations
end

class Table < ActiveRecord::Base
  has_many :reservations
  has_many :customers, :through => :reservations
end

我使用form_tag搜索了一个表的选择。如果客户找到了正确的表格,他可以点击“预订此表”链接,然后指示他 到new_customer_path申请他的姓名和电子邮件地址。 我的问题现在是保留。如何使用所选表格和新创建的客户动态/自动添加预订?

提前谢谢。

mbc0815

0 个答案:

没有答案
相关问题