Files
mozo-backend/app/controllers/users/tables_controller.rb
T
2015-09-03 20:42:48 +02:00

16 lines
578 B
Ruby

module Users
class TablesController < Users::ApplicationController
def show
@table = Table.find(params[:id])
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