app/views/users/_form.html.erb
<%= form_for user do |f| %>
<% if user.errors.any? %>
<div id='error_explanation'>
<h2><%= pluralize(user.errors.count, 'error') %> prohibited this user from being saved:</h2>
<ul>
<% user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :name, 'Username' %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :password %><br>
<%= f.password_field :password %>
</p>
<p>
<%= f.label :password_confirmation %><br>
<%= f.password_field :password_confirmation %>
</p>
<% if user.new_record? %>
<%= f.submit 'Sign up' %>
<% else %>
<%= f.submit 'Update Profile' %>
<% end %>
<% end %>