Sha256: 0370988e633f50ace9410e020ad913e12fc97466c70beec508a71976541efb56
Contents?: true
Size: 1.72 KB
Versions: 9
Compression:
Stored size: 1.72 KB
Contents
module Logistics module Core class AgencyCategoriesController < ApplicationController before_action :set_agency_category, only: [:update] # GET /agency_categories # GET /agency_categories.json def index agency_categories = AgencyCategory.all response = Mks::Common::MethodResponse.new(true, nil, agency_categories, nil, nil) render json: response end # POST /agency_categories # POST /agency_categories.json def create @agency_category = AgencyCategory.new(agency_category_params) if @agency_category.save response = Mks::Common::MethodResponse.new(true, "Agency Category information saved successfully!", @agency_category, nil, nil) else errors = Mks::Common::Util.error_messages @agency_category, "Agency Category" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end # PATCH/PUT /agency_categories/1 # PATCH/PUT /agency_categories/1.json def update if @agency_category.update(agency_category_params) response = Mks::Common::MethodResponse.new(true, "Agency Category information updated successfully!", @agency_category, nil, nil) else errors = Mks::Common::Util.error_messages @agency_category, "Agency Category" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end private def set_agency_category @agency_category = AgencyCategory.find(params[:id]) end def agency_category_params params.require(:agency_category).permit(:code, :name, :description) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems