正在使用 Shoppe 检索订单商品的图像 gem

Retrieving image for order item with Shoppe gem

无法检索要在当前订单中显示的订单商品图像。

尝试做这样的事情 -

<% order.order_items.each do |item| %>
  <td><%= image_tag item.default_image.path, :width => '200px', :style => "float:right" %></td>
<% end %>

有人做过吗before/have有什么想法吗?我目前正在为 'default_image'.

获取一个未定义的方法

谢谢!!!!!!!!

编辑

    undefined method `default_image' for #<Shoppe::OrderItem:0x007f494834a308>



    app/views/shared/_current_basket.html.erb:14:in `block in 
_app_views_shared__current_basket_html_erb__3066740198477643044_69976360480880'
    app/views/shared/_current_basket.html.erb:13:in `_app_views_shared__current_basket_html_erb__3066740198477643044_69976360480880'
    app/views/orders/show.html.erb:5:in `_app_views_orders_show_html_erb___1356602738108519273_49665800'

default_image 是为 Shoppe::Product 定义的,所以我想我只是在寻找一种类似的方法来检索订单中产品的图像。我似乎无法在 gem 或文档中找到任何内容,想知道是否有人知道解决方法或我错过的东西!

试试这个:

<%= image_tag item.ordered_item.default_image.path, :width => "###px", :style => "style:style" %>