Ruby on rails 从rails循环中排除记录-Spree

Ruby on rails 从rails循环中排除记录-Spree,ruby-on-rails,ruby,ruby-on-rails-3,ruby-on-rails-3.2,spree,Ruby On Rails,Ruby,Ruby On Rails 3,Ruby On Rails 3.2,Spree,我正在使用,并已对其进行了轻微修改,但我有一个错误,我无法找出 基本上,get方法使用searcher类来查找所有分类法,并显示同一类别中的6个产品,在我看来,我只是显示前1个类别,因为有些产品有多个类别 我的问题是,在迁移过程中,我创建了一个名为“Tags”的分类法和一个名为“Featured”的子分类法(显示在主页上的产品),然后销毁父分类法,这样它就不会出现在面向客户的网站上。对于所有标记有特征分类单元的产品,抛出一个未定义的“is_product_line”错误方法。所有其他没有标注特征

我正在使用,并已对其进行了轻微修改,但我有一个错误,我无法找出

基本上,get方法使用searcher类来查找所有分类法,并显示同一类别中的6个产品,在我看来,我只是显示前1个类别,因为有些产品有多个类别

我的问题是,在迁移过程中,我创建了一个名为“Tags”的分类法和一个名为“Featured”的子分类法(显示在主页上的产品),然后销毁父分类法,这样它就不会出现在面向客户的网站上。对于所有标记有特征分类单元的产品,抛出一个未定义的“is_product_line”错误方法。所有其他没有标注特征分类单元的产品都能完美地工作

当get方法在控制器中构建类别时,我需要一种排除这个分类单元的方法。我已将其添加到方法中,但不确定如何将其从@categores build_searcher中排除({:taxon=>taxon.id,:per_page=>@@display_related_items}) } 结束 结束 渲染布局:false 结束 结束 结束 Get.html.erb

'products',:locals=>{:products=>category[:searcher]。检索_产品,:taxon=>category[:taxon]}%>
_product.html.erb

“图像”),产品,:itemprop=>“url”%>
50),产品,:class=>info',:itemprop=>name',:title=>product.name%>


我认为你应该能够从产品中剔除你的特色分类单元

product.taxons.reject{|t| t.name == 'Featured'}.each do |taxon|
<% @categories.first(1).each do |category| %>
  <%= link_to category[:taxon].pretty_name, spree.nested_taxons_path(category[:taxon].permalink) %>
  <%= render :partial => 'products', :locals => { :products => category[:searcher].retrieve_products, :taxon => category[:taxon] } %>
<% end %>
<% if products.any? %>
  <% products.each do |product| %>
  <div id="product_<%= product.id %>" class="columns large-2" data-hook="products_list_item" itemscope itemtype="http://schema.org/Product">
    <div class="product-image">
      <%= link_to product_image(product, :itemprop => "image"), product, :itemprop => 'url' %>
    </div>
    <%= link_to truncate(product.name, :length => 50), product, :class => 'info', :itemprop => "name", :title => product.name %>
    <p class="price selling" itemprop="price"><%= display_price(product) %></p>
  </div>
  <% end %>
<% end %>
product.taxons.reject{|t| t.name == 'Featured'}.each do |taxon|