<% @pid = item.producto_id %>
<br/>
Producto: <%= Producto.find_by_id(@pid) %><br/>
Costo de Compra: <%= @costo_de_compra = Producto.find(:all, :conditions => "id = '#{@pid}'").*.costo_de_compra %><br/>
Precio de venta: <%= @precio_de_venta = item.precio_de_venta %><br/>
Utilidad de este producto: <%= @precio_de_venta - @costo_de_compra %><br/><br/>
<% end %>
在我的控制器中我有=
@ventas_ocurridas_en_este_periodo = Venta.find(:all, :conditions => ['created_at >= ? and created_at <= ?', Date.today.beginning_of_month, Date.tomorrow])
当我循环并从最初不可用的项目中获取值时,我如何将从该循环中产生的所有值汇总为集中总数?
我也无法操作@precio_de_venta - @costo_de_compra ......关于数组的一些事情。