# GET /comptes/1
# GET /comptes/1.json
def show
- authorize @compte
+ authorize Compte
end
# GET /comptes/new
def new
+ authorize Compte
@compte = Compte.new
- authorize @compte
-
@structures = Structure.all
3.times { @compte.contacts.build }
end
# GET /comptes/1/edit
def edit
- authorize @compte
-
+ authorize Compte
@structures = Structure.all
3.times { @compte.contacts.build }
end
# POST /comptes
# POST /comptes.json
def create
+ authorize Compte
@compte = Compte.new(compte_params)
- authorize @compte
respond_to do |format|
if @compte.save
# PATCH/PUT /comptes/1
# PATCH/PUT /comptes/1.json
def update
+ authorize Compte
+
respond_to do |format|
if @compte.update(compte_params)
- authorize @compte
format.html { redirect_to @compte, notice: 'Compte was successfully updated.' }
format.json { render :show, status: :ok, location: @compte }
else
# DELETE /comptes/1
# DELETE /comptes/1.json
def destroy
- authorize @compte
+ authorize Compte
+
@compte.destroy
respond_to do |format|
format.html { redirect_to comptes_url, notice: 'Compte was successfully destroyed.' }