JSONApi progress

This commit is contained in:
2015-09-03 20:42:48 +02:00
parent f47a8a9ed0
commit e4dde28dd0
27 changed files with 215 additions and 64 deletions
+8 -1
View File
@@ -2,7 +2,14 @@ module Users
class TablesController < Users::ApplicationController
def show
@table = Table.find(params[:id])
render json: @table, serializer: Users::TableSerializer
render json: JSONAPI::Serializer.serialize(@table, serializer: Users::TableSerializer)
end
def supplier
table = Table.find(params[:id])
supplier = table.supplier
supplier.product_categories.include_relations(:products)
render json: JSONAPI::Serializer.serialize(supplier, serializer: Users::SupplierSerializer, include: %w[product_categories product_categories.products product_categories.supplier])
end
end
end