From abf943acdcd16d1a750dad91f6fe5e7253e6da19 Mon Sep 17 00:00:00 2001 From: "Butler, Alexis (UG - Computer Science)" <ab02259@surrey.ac.uk> Date: Tue, 1 Dec 2020 09:46:54 +0000 Subject: [PATCH] Render streaming for partial heavy controller methods --- app/controllers/products_controller.rb | 1 + app/controllers/sections_controller.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 301814e..72c9f2c 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -3,6 +3,7 @@ class ProductsController < ApplicationController # Display the table of products by date added def index @products = Product.all.order(created_at: :desc) + render stream: true end # Display a specific product given an ID diff --git a/app/controllers/sections_controller.rb b/app/controllers/sections_controller.rb index a797dbe..06f5b9f 100644 --- a/app/controllers/sections_controller.rb +++ b/app/controllers/sections_controller.rb @@ -5,5 +5,6 @@ class SectionsController < ApplicationController def show @section = Section.find(params[:id]) @products = @section.products.order(created_at: :asc) + render stream: true end end -- GitLab