Home>

Create an error message with a partial, enter and post an invalid value
When an error message is output, the array is also displayed below.

Error message code (partial)
<% if model.errors.any?%>
  
    <ul>
      <% = model.errors.full_messages.each do | msg |%>
        <li><% = msg%></li>
      <% end%>
    </ul>
  
<% end%>
Validation
class Agent</pre>
<strong>Japanese localization of error messages (gem 'rails-i18n')</strong>
<pre><code>module Kotosearch
  class Application<Rails :: Application
    config.load_defaults 6.0
    config.i18n.default_locale =: ja
    config.i18n.load_path + = Dir [Rails.root.join ('config', 'locales', '**', '* .yml'). to_s]
    config.action_view.field_error_proc = Proc.new {| html_tag, instance | html_tag}
  end
end

bootstrap is not used.

If i know,
I would appreciate your help.

  • Answer # 1

    <% = model.errors.full_messages.each do | msg |%>
    Isn't the=written here and displayed?

Related articles