JSON api serializers for suppliers

This commit is contained in:
2015-09-09 19:11:46 +02:00
parent 5cdbe57dec
commit 968d042501
37 changed files with 86 additions and 133 deletions
@@ -5,8 +5,16 @@ module Suppliers
end
def show
[current_supplier].include_relations(sections: :tables, product_categories: {products: :product_variants})
render json: JSONAPI::Serializer.serialize(current_supplier, serializer: Suppliers::SupplierSerializer) #.new(current_supplier).as_json
current_supplier.sections.include_relations(:tables, :section_areas, :section_elements, product_categories: {products: :product_variants})
render json: JSONAPI::Serializer.serialize(current_supplier, serializer: Suppliers::SupplierSerializer, include: %w[
sections
sections.tables
sections.section_areas
sections.section_elements
product_categories
product_categories.products
product_categories.products.product_variants
]) #.new(current_supplier).as_json
end
def update