diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 494068476..7ad52e4bc 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -7,8 +7,11 @@ class AccountController < ApplicationController end def update - flash[:notice] = t("flash.actions.save_changes.notice") if @account.update(account_params) - redirect_to account_path + if @account.update(account_params) + redirect_to account_path, notice: t("flash.actions.save_changes.notice") + else + render :show + end end private diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index d3feef475..578838792 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -3,6 +3,18 @@

<%= t("account.show.title") %>

<%= form_for @account, as: :account, url: account_path do |f| %> + + <% if @account.errors.any? %> +
+

<%= pluralize(@account.errors.count, t("debates.form.error"), t("debates.form.errors")) %> <%= t("debates.form.not_saved") %>

+ +
+ <% end %> +
<%= f.label :first_name, t("account.show.first_name_label") %>