diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index faa4f63..53d948a 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -172,7 +172,7 @@ end redirect_to admin_template_template_path(), notice: _('Information was successfully updated.') else - redirect_to admin_template_template_path(@template) + redirect_to admin_template_template_path(@template), notice: _('Unable to save your changes.') end end @@ -204,6 +204,7 @@ if @template.save redirect_to admin_template_template_path(@template), notice: _('Information was successfully created.') else + flash[:notice] = _('Unable to save your changes.') render action: "admin_new" end end diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index f21755c..d75196f 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -145,7 +145,7 @@ post admin_create_template_path(Template.last.id), {template: {title: nil, org_id: @user.org.id}} assert_response :success assert assigns(:template) - # TODO: Should also probably display the reason why it failed! + assert_equal _('Unable to save your changes.'), flash[:notice] end # GET /org/admin/templates/:id/admin_update (admin_update_template_path) @@ -181,7 +181,7 @@ assert_response :redirect assert_redirected_to admin_template_template_url(Template.last.id) assert assigns(:template) - # TODO: Should also probably display the reason why it failed! + assert_equal _('Unable to save your changes.'), flash[:notice] end end \ No newline at end of file