site_perso_app/app/controllers/admin/admins_controller.rb
2013-02-07 11:44:54 +01:00

63 lines
829 B
Ruby

class Admin::AdminsController < ApplicationController
layout "admin"
before_filter :authenticate_admin!
def index
@admins = Admin.all
end
def show
@admin = Admin.find(params[:id])
end
def new
@admin = Admin.new
end
def edit
@admin = Admin.find(params[:id])
end
def create
@admin = Admin.new(params[:admin])
if @admin.save
redirect_to admin_admins_path
else
render :action => "new"
end
end
def update
@admin = Admin.find(params[:id])
if @admin.update_attributes(params[:admin])
redirect_to admin_admin_path(@admin)
else
render :action => "edit"
end
end
def destroy
@admin = Admin.find(params[:id])
@admin.destroy
redirect_to admin_admins_path
end
end