# -*- encoding : utf-8 -*- class Admin::PPriceCatsController < ApplicationController layout "admin" before_filter :auth_admin before_filter :admin_space def admin_space @admin_space = "ventes" 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 @p_price_cats = PPriceCat.order(:name).all 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!) @p_price_cats = PPriceCat.order(:name).all else render action: "edit" end end def destroy @p_price_cat = PPriceCat.find(params[:id]) @p_price_cat.destroy end end