A view displays two forms: one to update user's email, one to update user's password (using Devise RegistrationsController
).
Both forms rely on User
, point to PUT registration_path(resource_name)
and include a password_field :current_password
as:
# update_email form<%= form_for(resource, as: :resource_name, url: registration_path(resource_name), html: { method: :put } do |f| %><%= f.email_field :email %><%= f.password_field :current_password %> # <- DUPLICATED<% end %># update_password form<%= form_for(resource, as: :resource_name, url: registration_path(resource_name), html: { method: :put } do |f| %><%= f.password_field :current_password %> # <- DUPLICATED<%= f.password_field :password %><%= f.password_field :password_confirmation%><% end %>
Issue is that if there's an error on one input field current_password
, all fields related to this attribute will be marked as error. It can be missleading to users which may think they've to fill both forms.
How can I prevent ActionView::Base.field_error_proc
from propagating to all inputs?