blob: cbe46d89a4c7a10c1fc4e231bb65542918a904cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
# frozen_string_literal: true
# CartSerializer
class CartSerializer < BaseSerializer
attribute :products do |object|
ProductSerializer.new(
Product.joins(:product_carts).select('products.*', 'product_carts.quantity AS quantity')
.includes(picture_attachment: :blob).where('product_carts.cart_id = ?', object.id)
).serializable_hash
end
end
|