From ae66a85cc57d56ac68b3d14a3557744c39f04b1e Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 5 Jun 2024 14:06:03 +1000 Subject: [PATCH] Show error messages There shouldn't normally be errors, but I got one due to bad data during development, and this helped sort it out. --- app/controllers/admin/column_preferences_controller.rb | 3 ++- config/locales/en.yml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/column_preferences_controller.rb b/app/controllers/admin/column_preferences_controller.rb index 9d39e050fb..abe14e4d22 100644 --- a/app/controllers/admin/column_preferences_controller.rb +++ b/app/controllers/admin/column_preferences_controller.rb @@ -18,7 +18,7 @@ module Admin respond_to do |format| format.json { render json: { errors: @cp_set.errors }, status: :bad_request } format.turbo_stream { - flash.now[:error] = t('.error') + flash.now[:error] = @cp_set.errors.full_messages.to_sentence render :bulk_update, locals: { action: permitted_params[:action_name] } } end @@ -55,6 +55,7 @@ module Admin } end end + @cp_set = Sets::ColumnPreferenceSet.new(@column_preferences, collection_attributes:) end diff --git a/config/locales/en.yml b/config/locales/en.yml index c3bdca88a8..a5881d9c68 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -764,7 +764,6 @@ en: column_preferences: bulk_update: success: "Column preferences saved" - error: "Column preferences could not be saved" contents: edit: title: Content