Can't display/access products with Rails

New Member
4 0 0

So this is my Products controller



class ProductsController < AuthenticatedController
  def index
    @products = ShopifyAPI::Product.find(:all, params: { limit: 10 })
    render(json: { products: @products })



And this is how I want to display the products in views/products/index.html.erb:


<% @products.each do |p| %>
  <p><%= p.title %></p>
<% end %>



And my route:



get '/products', :to => 'products#index'



But when I redirect my page to /products, I get this message:




Which doesn't happen with all my other routes, so what am I doing wrong? Am I missing something?


Replies 0 (0)