I have a view that I use to update the user model and the profile model in one which works!
<h2>Edit</h2>
<%= form_for(@profile) do |f| %>
<% if @profile.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@profile.errors.count, "error") %> prohibited this profile from being saved:</h2>
<ul>
<% @profile.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= fields_for @profile.user do |u| %>
<div><%= u.label :email %><br />
<%= u.email_field :email, autofocus: true %>
</div>
<% end %>
<div><%= f.label :alias %><br />
<%= f.text_field :alias %>
</div>
<div>
<%= f.label :sex %><br />
<%= f.select :sex, gender_options %>
</div>
<div><%= f.label :dob %><br />
<%= f.date_select :dob, order: [:day, :month, :year], start_year: Date.today.year -100 %>
</div>
<div><%= f.submit "Update" %></div>
<% end %>
This allows the user to update their email address and as I am using reconfirmable then an email is correctly sent to the user to confirm the change of email address.
The original devise view contains the following which informs the user if an email confirmation is pending:
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
The original devise form also includes the following form header:
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
I would like to incorporate these devise functions into my form but am unsure of where and how they should be included as I am using fields_for for my devise "email" field as opposed to form_for.