rails 异常提示样式
rails 错误提示样式
源码 # Specify the proc used to decorate input tags that refer to attributes with errors. cattr_accessor :field_error_proc @@field_error_proc = Proc.new{ |html_tag, instance| "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe }
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
%{<div class="has-error">#{html_tag}<span class="help-block">#{instance.error_message.join(',')}</span></div>}.html_safe
end