class BrickLayer::AdministratorsController < BrickLayer::BaseController before_filter :find_admin, :except => [:index, :new, :create] respond_to :html def index @administrators = BrickLayer::Administrator.all end def new @administrator = BrickLayer::Administrator.new end def create @administrator = BrickLayer::Administrator.new(params[:administrator]) if @administrator.save flash[:success] = "You Created a New Administrator!" redirect_to administrators_path else render "new" end end def update if @administrator.update_attributes(params[:administrator]) flash[:success] = "Administrator Updated!" redirect_to administrators_path else render "edit" end end def destroy @administrator.destroy flash[:success] = "Administrator Removed!" redirect_to administrators_path end private def find_admin @administrator = BrickLayer::Administrator.find(params[:id]) end end