diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 9504241..6a4a9c0 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -48,8 +48,10 @@ class ProductsController < ApplicationController def index @products = Product.all @categories = Product.categories - - render 'products_list/listview' if current_user.admin? + respond_to do |format| + format.json { render json: @products } + format.html { render 'products_list/listview' if current_user.admin? } + end end def edit