Base progress
This commit is contained in:
@@ -2,13 +2,13 @@ module Suppliers
|
||||
class SectionAreasController < Suppliers::ApplicationController
|
||||
def index
|
||||
@section_areas = SectionArea.for_supplier(current_supplier)
|
||||
render json: JSONAPI::Serializer.serialize(@section_areas, serializer: Suppliers::SectionAreaSerializer, is_collection: true)
|
||||
render json: @section_areas
|
||||
end
|
||||
|
||||
def create
|
||||
@section_area.supplier = current_supplier
|
||||
if @section_area.save
|
||||
render json: JSONAPI::Serializer.serialize(@section_area, serializer: Suppliers::SectionAreaSerializer)
|
||||
render json: @section_area
|
||||
else
|
||||
render json: {errors: @section.errors}, status: :unprocessable_entity
|
||||
end
|
||||
@@ -16,7 +16,7 @@ module Suppliers
|
||||
|
||||
def update
|
||||
if @section_area.update_attributes section_area_params
|
||||
render json: JSONAPI::Serializer.serialize(@section_area, serializer: Suppliers::SectionAreaSerializer)
|
||||
render json: @section_area
|
||||
else
|
||||
render json: {errors: @section.errors}, status: :unprocessable_entity
|
||||
end
|
||||
@@ -24,7 +24,7 @@ module Suppliers
|
||||
|
||||
def destroy
|
||||
@section_area.destroy
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user