0

该场景是当客户预订(电话或电子邮件)公寓(没有购物车)时,会生成个人资料。客户可以登录并查看所有详细信息,如路线、地址、实用信息等。

这是我的模型:

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
              &#8364;
              = 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

4

0 回答 0