Railsドキュメント

アクティブレコードでのエラーを表示するためのHTMLジェネレーターの設定

説明

Active Recordでのエラーを表示するためのHTMLジェネレーター。デフォルトは、

Proc.new do |html_tag, instance|
  %Q(<div class="field_with_errors">#{html_tag}</div>).html_safe
end

使い方

config.action_view.field_error_proc

config.action_view.field_error_proc = Proc.new { |html_tag, instance|
  "#{html_tag}".html_safe
}