JSONApi progress
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user