Skip to content

Instantly share code, notes, and snippets.

@koko-u
Created May 26, 2011 21:41
Show Gist options
  • Save koko-u/994151 to your computer and use it in GitHub Desktop.
Save koko-u/994151 to your computer and use it in GitHub Desktop.
rails エラーメッセージのタイトル日本語化
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= t(:header, :model => t(:user, :scope => [:activerecord, :models]),
:count => @user.errors.count, :scope => [:activerecord, :errors, :template]) %></h2>
<p><%= t(:body, :scope => [:activerecord, :errors, :template]) %></p>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment