Rails Spree Extension doesn't show instance in view -
the default spree commerce has "categories" , "brand" taxonomies. have generated extension creates custom testing page taxonomies displayed, in reverse order. practicing purposes.
the custom testing page "/testing" seems routing correctly , using view testing.html.erb
, can not load taxonomies instance defined in method. gives me undefined method each nil:nilclass
.
note: i'm working in extension only, not in spree app.
spree_custom_extension/controllers/spree/home_controller_extension.rb
module spree homecontroller.class_eval def testing @taxonomies = spree::taxonomy.includes(root: :children).reverse_order end end end
spree_custom_extension/views/spree/home/testing.html.erb
<% @taxonomies.each |taxonomy| %> <%= taxonomy.name %><br> <% end %>
spree_custom_extension/config/routes.rb
spree::core::engine.routes.draw '/testing' => 'home#testing' end
Comments
Post a Comment