def admin_delete
      return unless user_is_allowed('categories', 'delete')
      
      category = Category.find(params[:id])
      
      if category.products.any?
        render :json => { :error => "Can't delete a category that has products in it." }
      elsif category.children.any?
        render :json => { :error => "You can't delete a category that has child categories." }
      else
        render :json => { :success => category.destroy, :redirect => '/admin/categories' }
      end
    end
def admin_delete
      return unless user_is_allowed('categories', 'delete')
      
      category = Category.find(params[:id])
      
      if category.products.any?
        render :json => { :error => "Can't delete a category that has products in it." }
      elsif category.children.any?
        render :json => { :error => "You can't delete a category that has child categories." }
      else
        render :json => { :success => category.destroy, :redirect => '/admin/categories' }
      end
    end
DELETE /admin/categories/:id