Base progress

This commit is contained in:
2015-09-16 11:50:55 +02:00
parent ef894f9e02
commit 6a085b1ca2
52 changed files with 3686 additions and 1818 deletions
@@ -2,13 +2,13 @@ module Suppliers
class SectionElementsController < Suppliers::ApplicationController
def index
@section_elements = SectionElement.for_supplier(current_supplier)
render json: JSONAPI::Serializer.serialize(@section_elements, serializer: Suppliers::SectionElementSerializer, is_collection: true)
render json: @section_elements
end
def create
@section_element.supplier = current_supplier
if @section_element.save
render json: JSONAPI::Serializer.serialize(@section_element, serializer: Suppliers::SectionElementSerializer)
render json: @section_element
else
render json: {errors: @section.errors}, status: :unprocessable_entity
end
@@ -16,15 +16,15 @@ module Suppliers
def update
if @section_element.update_attributes section_element_params
render json: JSONAPI::Serializer.serialize(@section_element, serializer: Suppliers::SectionElementSerializer)
render json: @section_element
else
render json: {errors: @section.errors}, status: :unprocessable_entity
end
end
def destroy
@section_element.destroy()
head :ok
@section_element.destroy
head :no_content
end
private