From 12b57cc8b562c0b21951d3d05c53e4a689230bd9 Mon Sep 17 00:00:00 2001 From: Janell-Huyck Date: Thu, 1 Feb 2024 17:05:30 -0500 Subject: [PATCH] Correct class names in flash messages --- app/controllers/publications_controller.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/publications_controller.rb b/app/controllers/publications_controller.rb index e830b9e3..a9c2538a 100644 --- a/app/controllers/publications_controller.rb +++ b/app/controllers/publications_controller.rb @@ -124,7 +124,9 @@ def create respond_to do |format| if instance_variable.save PublicationMailer.publication_submit(helpers.find_submitter(session[:submitter_id]), instance_variable).deliver_now - flash.keep[:success] = "#{controller_name.classify} was successfully created." + class_name = controller_name.classify + formatted_name = class_name.underscore.humanize.titleize + flash.keep[:success] = "#{formatted_name} was successfully created." format.html { redirect_to publications_path } format.json { render :show, status: :created, location: instance_variable } else @@ -138,7 +140,9 @@ def update instance_variable = instance_variable_get("@#{controller_name.singularize}") respond_to do |format| if instance_variable.update(allowed_params) - flash.keep[:success] = "#{controller_name.classify} was successfully updated." + class_name = controller_name.classify + formatted_name = class_name.underscore.humanize.titleize + flash.keep[:success] = "#{formatted_name} was successfully updated." format.html { redirect_to instance_variable } format.json { render :show, status: :created, location: instance_variable } else @@ -152,7 +156,9 @@ def destroy instance_variable = instance_variable_get("@#{controller_name.singularize}") instance_variable.destroy respond_to do |format| - flash.keep[:warning] = "#{controller_name.classify} was successfully destroyed." + class_name = controller_name.classify + formatted_name = class_name.underscore.humanize.titleize + flash.keep[:warning] = "#{formatted_name} was successfully destroyed." format.html { redirect_to publications_path } format.json { head :no_content } end