LoginSignup
3
3

More than 5 years have passed since last update.

Rails3ではerror_messagesは使えない

Posted at

Rails2でerror_messagesでバリデートしたエラーをビューで表示させていたけど、
Rails3で廃止になったらしい。

代わりの記述方法を例をメモメモ

<% if @ad.errors.any? %>
  <ul>
    <% @ad.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
  </ul>
<% end %>
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3