End of day commit
This commit is contained in:
@@ -19,14 +19,12 @@ module Suppliers
|
||||
# POST /employees.json
|
||||
def create
|
||||
@employee = Employee.new(employee_params)
|
||||
@employee.supplier = current_supplier
|
||||
|
||||
respond_to do |format|
|
||||
if @employee.save
|
||||
render json: @employee, serializer: Suppliers::EmployeeSerializer, status: :created
|
||||
else
|
||||
render json: {errors: @employee.errors}, status: :unprocessable_entity
|
||||
end
|
||||
if @employee.save
|
||||
current_supplier.add_employee @employee
|
||||
render json: @employee, serializer: Suppliers::EmployeeSerializer, status: :created
|
||||
else
|
||||
render json: {errors: @employee.errors}, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user