Skip to content

Commit

Permalink
Update devise error messages
Browse files Browse the repository at this point in the history
Devise 4.6.0 deprecated the `devise_error_messages!` helper method in
favour if just rendering a partial including the library. [1]

We can (optionally) copy that partial into our codebase, where we can
edit it, and it will be preferentially used over the one in the gem
code. However, the existing helper had no customisations so I didn't go
down that route yet.

[1] https://github.com/heartcombo/devise/blob/main/CHANGELOG.md#460---2019-02-07
  • Loading branch information
bagedevimo committed Jan 6, 2024
1 parent 86f5180 commit 58675d4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/views/accounts/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2>Edit <%= params[:type] %> <%#= resource_name.to_s.humanize %></h2>

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name, :type => params[:type]), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<% if params[:type] == 'username' %>
<p><%= f.label :username %><br />
<%= resource.can_change_username ? f.text_field(:username) : resource.username %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<li>Access more problems.</li>
</ul>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<h3><%= f.label :username %></h3>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/settings/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% toolbox_push :back, :back %>

<%= form_for(resource, :as => resource_name, :url => "/accounts/settings/update", :html => { :multipart => true, :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<h3><%= f.label :username %></h3>
Expand Down

0 comments on commit 58675d4

Please sign in to comment.