Sha256: 37e8922a4dad72ddedeaab6faa4c8c5e07a40884ff009ed8dad0d7a185cfe472
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
module Mks module Rate class ServiceTypesController < ApplicationController before_action :set_service_type, only: %i[show update] def index @service_types = ServiceType.all render json: @service_types end def show render json: @service_type end def create @service_type = ServiceType.new(service_type_params) if @service_type.save render json: @service_type, status: :created, location: @service_type else render json: @service_type.errors, status: :unprocessable_entity end end def update if @service_type.update(service_type_params) render json: @service_type else render json: @service_type.errors, status: :unprocessable_entity end end private def set_service_type @service_type = ServiceType.find(params[:id]) end def service_type_params params.require(:service_type).permit(:code, :name) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems