This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/controllers/admin/p_price_cats_controller.rb
2021-08-23 10:26:02 +02:00

66 lines
961 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::PPriceCatsController < ApplicationController
layout "admin"
before_action :auth_admin
before_action :admin_space
def admin_space
@admin_space = "default"
end
def index
@p_price_cats = PPriceCat.order(:name).all
end
def show
@p_price_cat = PPriceCat.find(params[:id])
end
def new
@p_price_cat = PPriceCat.new
end
def edit
@p_price_cat = PPriceCat.find(params[:id])
end
def create
@p_price_cat = PPriceCat.new(params.require(:p_price_cat).permit!)
if @p_price_cat.save
else
render action: "new"
end
end
def update
@p_price_cat = PPriceCat.find(params[:id])
if @p_price_cat.update_attributes(params.require(:p_price_cat).permit!)
else
render action: "edit"
end
end
def destroy
@p_price_cat = PPriceCat.find(params[:id])
@p_price_cat.destroy
end
end