form_for error messages in Ruby on Rails

ruby, ruby-on-rails, ruby-on-rails-4

Solution

Same as Rails 3 -- see f.error_messages in Rails 3.0 or http://railscasts.com/episodes/211-validations-in-rails-3 for many different possibilities.

My personal preference is to use simple_form and have it put the error next to the input.

Problem

What is the preferred way to display validation error messages using `form_for` in Rails 4? ``` <%= form_for @post do |f| %> ... <% end %> ```

Original source

Related problems