Sha256: 7eef9ae68007c266fa83b595ba4404f54a6237b5a43ec1b59a960d19f60b8a71
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
module Mks module Edm class LocationTypesController < ApplicationController before_action :set_location_type, only: [:update] def index render json: Mks::Common::MethodResponse.success_response(LocationType.all) end def create lt = LocationType.new(location_type_params) if lt.valid? lt.save res = Mks::Common::MethodResponse.success_response(lt, 'Location type saved successfully !') render json: res else res = Mks::Common::MethodResponse.failure_response(lt) render json: res, status: :unprocessable_entity end end def update if @lt.update(location_type_params) res = Mks::Common::MethodResponse.success_response(@lt, 'Location type updated successfully !') render json: res else res = Mks::Common::MethodResponse.failure_response(@lt) render json: res, status: :unprocessable_entity end end private def location_type_params params.require(:location_type).permit(:id, :code, :name, :description) end def set_location_type @lt = LocationType.find(params[:id]) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems