From f68124a6dff2b0b6131280be2378a049d9d839d4 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Thu, 16 Mar 2023 22:34:51 -0600 Subject: Mejora las queries --- app/controllers/api/companies_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/api/companies_controller.rb') diff --git a/app/controllers/api/companies_controller.rb b/app/controllers/api/companies_controller.rb index 086ac5b..973eedb 100644 --- a/app/controllers/api/companies_controller.rb +++ b/app/controllers/api/companies_controller.rb @@ -4,7 +4,7 @@ module Api # CompaniesController class CompaniesController < MasterController def index - @companies = Company.page(params[:page]) + @companies = Company.all render json: serialized_collection.serializable_hash, status: 200 end @@ -44,7 +44,7 @@ module Api end def serialized_collection - Serializers::CompanySerializer.new(@companies.page(params[:page])) + Serializers::CompanySerializer.new(@companies.includes(logo_attachment: :blob).page(params[:page])) end def permitted_params -- cgit v1.2.3