@taxon = Taxon.find_by_permalink(params[:id])
@related_products = @taxon.products.offset(rand(Spree::Product.count)).limit
(7).name
I've tested a form of this and it is pulling a random object, but when I
put it in my show view:
<ul>
<%= @related_products.each do |related_product| %>
<li><%= related_product.name %></li>
<% end %>
</ul>
I get a NoMethodError in Spree/taxons#show
undefined method `each' for "Spree::Product":String
Extracted source (around line *#41*):
38: <% end %>
39: </div><!-- popup-images -->
40: <ul>
41: <%= @related_products.each do |related_product| %>
42: <li><%= related_product.name %></li>
43: <% end %>
44: </ul>
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.