class Admin::ReseauxesController < ApplicationController layout "admin" def index @reseauxes = Reseaux.order(:name) end def new @reseaux = Reseaux.new() end def create @reseaux = Reseaux.new(reseaux_params) if @reseaux.save flash[:notice] = "Catégorie créée avec succès." redirect_to admin_reseauxes_path else render "new" end end def edit @reseaux = Reseaux.find(params[:id]) end def show @reseaux = Reseaux.find(params[:id]) end def update @reseaux = Reseaux.find(params[:id]) if @reseaux.update_attributes(reseaux_params) flash[:notice] = "Catégorie modifiée avec succès." redirect_to admin_reseauxes_path else render :action => "edit" end end def destroy @reseaux = Reseaux.find(params[:id]) if !@reseaux.superadmin and @reseaux.destroy flash[:notice] = "Reseauxe supprimée avec succès." else flash[:error] = "Impossible de supprimer ce reseauxe." end redirect_to :action => :index end def reseaux_params params.require(:reseaux).permit! end end