over 1 year ago

1、如何利用session设计购物车?

2、session是什么?

3、present?是什么意思

      <% sum = 0 %>
      <% current_cart.cart_items.each do |cart_item| %>
          <% if cart_item.product.price.present? %>
            <% sum = sum + cart_item.quantity * cart_item.product.price %>
          <% end %>
        <% end %>
      总计 <%= sum %> 元(RMB)

4、find_by与find的区别?

5、blank?

6、如何隐藏流水号并能正确找到对应订单的?

7、 belongs_to :user 的作用?
class Order < ApplicationRecord
belongs_to :user
validates :billing_name, presence: true
validates :billing_address, presence: true
validates :shipping_name, presence: true
validates :shipping_address, presence: true
end

← 20170206 查看logdown完整地址的方法 →
 
comments powered by Disqus