Update app/controllers/announcement_controller.rb

Add safety check during record operation