Singular message
<%= error_messages_for 'user' %>
Plural messages
<%= error_messages_for 'article' %>
Multi object
<%= error_messages_for 'article', 'user' %>
Multi object with :object_name
<%= error_messages_for 'article', 'user', :object_name => _("Contents") %>
Multi object with :object
<%= error_messages_for :object => [@article, @user] %>
Change header with gettext options
<%= error_messages_for 'user', {
:message_title => Nn_("Singular Custom Error message %{record}: %{num}", "Plural Custom Error message %{record}: %{num}"),
:message_explanation => Nn_("Singular Custom Error explanation %{num}", "Plural Custom Error explanation %{num}")
} %>
Same result with Rails options
<%= error_messages_for 'user', {
:header_message => Nn_("Singular Custom Error message %{record}: %{num}", "Plural Custom Error message %{record}: %{num}"),
:message => Nn_("Singular Custom Error explanation %{num}", "Plural Custom Error explanation %{num}")
} %>
nil header
<%= error_messages_for 'user', {
:header_message => nil,
:message => Nn_("Singular Custom Error explanation %{num}", "Plural Custom Error explanation %{num}")
} %>
nil message
<%= error_messages_for 'user', {
:header_message => Nn_("Singular Custom Error message %{record}: %{num}", "Plural Custom Error message %{record}: %{num}"),
:message => nil
} %>
nil header message and nil message
<%= error_messages_for 'user', {
:header_message => nil,
:message => nil
} %>
String header message
<%= error_messages_for 'user', {
:header_message => "String Header Message",
:message => "String Message"
} %>