【发布时间】:2015-09-17 19:46:23
【问题描述】:
我正在使用 acts_as_shopping_cart gem 为我的 rails 4 应用程序构建购物车功能。 gem 有助于呈现一张漂亮的表格,其中包含订单的价格、数量和总数。我想将此作为 html 收据保存在我的交易表中的文本列下。
这些是我要保存的视图:
shopping_carts/show.html.erb
<h1>Shopping Cart</h1>
<%= render :partial => 'shopping_cart_item', :collection => @shopping_cart.shopping_cart_items %>
<div>
<div><b>SubTotal:</b><%= number_to_currency @shopping_cart.subtotal %></div>
<div><b>Taxes:</b><%= number_to_currency @shopping_cart.taxes %></div>
<div><b>Total:</b><%= number_to_currency @shopping_cart.total %></div>
/shopping_carts/_shopping_cart_item.html.erb
<div>
<div><%= shopping_cart_item.item.name %></div>
<div><%= shopping_cart_item.item.price %></div>
</div>
如何在我的 Transaction.receipt 字段中将其保存为一个 html 块?
【问题讨论】:
标签: ruby-on-rails forms ruby-on-rails-4 rendering