该场景是当客户预订(电话或电子邮件)公寓(没有购物车)时生成个人资料。客户可以登录并查看详细信息,如方向,地址,实用信息等。
这是我的模特:
class User < ActiveRecord::Base
has_many :bookings
has_many :apartments, through: :bookings
end
class Apartment < ActiveRecord::Base
has_many :bookings
has_many :users, through: :bookings
end
class Booking < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :user
belongs_to :appartment
end
查看用户
.span6
%header
%h3.text
Booking info
- @user.bookings.each do |booking|
%ul
%li
Ordernumber:
%b
= booking.ref
%li
Name accomodation
%b
= booking.apartment.try(:name)
%li
Price
%b
€
= booking.price
%li
%p
= link_to "Download Route PDF ", "https://docs.google.com#{booking.apartment.try(:route)}", :class => 'btn btn-primary'
客户可以在2周内租用3套不同的公寓。它仍然是一个具有相同订单号的预订。
我想显示3间公寓(例如)的总价。可能是这个设置...这个应用程序设置是否正确?我必须使用预先填写预订数据的购物篮(包含line_items)吗?
感谢... REMCO