summaryrefslogtreecommitdiff
path: root/app/controllers/api/products_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api/products_controller.rb')
-rw-r--r--app/controllers/api/products_controller.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/api/products_controller.rb b/app/controllers/api/products_controller.rb
index 213fa9f..2822a21 100644
--- a/app/controllers/api/products_controller.rb
+++ b/app/controllers/api/products_controller.rb
@@ -49,11 +49,18 @@ module Api
private
def serialized_object
- Serializers::ProductSerializer.new(@product)
+ Serializers::ProductSerializer.new(
+ @product.joins(:company)
+ .select('products.*', 'companies.name as company_name','companies.short_name as company_short_name')
+ )
end
def serialized_collection
- Serializers::ProductSerializer.new(@products.page(params[:page]))
+ Serializers::ProductSerializer.new(
+ @products.joins(:company)
+ .select('products.*', 'companies.name as company_name', 'companies.short_name as company_short_name')
+ .includes(picture_attachment: :blob).page(params[:page])
+ )
end
def permitted_params