spree-contrib / spree_related_products

Related products extension for Spree Commerce.

Home Page:http://guides.spreecommerce.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `empty?' for nil:NilClass

phuong3030 opened this issue · comments

Hello everyone,

I got this error 'undefined method `empty?' for nil:NilClass' when I install spree related products 3-0-stable to spree 3.0.4. Can you please help me to resolve the error? Thank you.

Showing /home/phuong3030/.rvm/gems/ruby-2.2.3@eshop/bundler/gems/spree_related_products-a265c6ee7418/app/views/spree/admin/products/related.html.erb where line #6 raised:

undefined method `empty?' for nil:NilClass
Extracted source (around line #6):


<%= csrf_meta_tag %>

<% if @relation_types.empty? %>
  <div class="alert alert-warning no-objects-found">
  <%= Spree.t(:no_relation_types) %>
</div>

I changed it back to old versions.

Spree::Admin::ProductsController.class_eval do
  def related
    load_resource
    @relation_types = Spree::Product.relation_types
  end
end

I get the same error can you elaborate what you did to fix it.

Thanks Manuel!

commented

+1 I got the same error