You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: announcements_controller.rb
    path of file: ./repos/Autolab/app/controllers
    
    the code of the file until where you have to start completion: # Extend the R
    
  def destroy
    if @announcement.destroy
      flash[:success] = "Announcement Deleted"
      redirect_to(action: :index) && return
    else
      flash[:error] = "Error Deleting Announcement"
      redirect_to(action: :edit) && return
    end