入力フォームのエラーメッセージを表示させる方法をまとめます。めちゃくちゃ簡単です。
Userモデルを登録するフォームの場合、フォームをsubmitしたときのエラーはuser.errorsに、エラーメッセージは、user.errors.full_messagesに保存されています。
そこで、下記のようにフォーム内でuser.errors.full_messages内のエラーメッセージをループを回して表示してあげるだけで完成です。
<%= form_for @user do |f| %>
<% if @user.errors %>
<ul>
<% @user.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
<% end %>
<div class="form-group">
<%= f.label :last_name, :姓 %>
<%= f.text_field :last_name %>
</div>
<div class="form-group">
<%= f.label :first_name, :名 %>
<%= f.text_field :first_name %>
</div>
<div class="form-group">
<%= f.label :email, :メールアドレス %>
<%= f.text_field :email %>
</div>
<div class="form-group">
<%= f.label :image, "プロフィール画像" %>
<%= f.file_field :image %>
</div>
<div class="form-group">
<%= f.label :password, :パスワード %>
<%= f.password_field :password %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, :パスワード確認 %>
<%= f.password_field :password_confirmation %>
</div>
<%= f.submit :登録, class: "btn btn-transparent" %>
<% end %>
Ruby on Railsをこれから本格的に勉強したい人は「エンジニアになるための600時間のプログラミング学習に耐え抜くコツ」という記事がおすすめです。