Sha256: a5ead7d9281a2a78ba164d0788bb4b458bee2247fdeb33119d1897f25cb7ccdd
Contents?: true
Size: 935 Bytes
Versions: 34
Compression:
Stored size: 935 Bytes
Contents
module Ecom module Core class UserRolesController < ApplicationController before_action :set_user_role, only: [:update] def index render json: UserRole.all end def create user_role = UserRole.new(user_role_params) if user_role.save render json: user_role, status: :created else render json: { success: false, errors: user_role.errors }, status: :unprocessable_entity end end def update if @user_role.update(user_role_params) render json: @user_role else render json: { success: false, errors: @user_role.errors }, status: :unprocessable_entity end end private def set_user_role @user_role = UserRole.find(params[:id]) end def user_role_params params.require(:user_role).permit(:name, :application_module_id) end end end end
Version data entries
34 entries across 34 versions & 1 rubygems