Changing the way form fields with errors are displayed


#1

What file I must to edit?

7.1. Changing the way form fields with errors are displayed
http://guides.rubyonrails.org/activerecord_validations_callbacks.html

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
if instance.error_message.kind_of?(Array)
%(#{html_tag} 
#{instance.error_message.join(’,’)}
)
else
%(#{html_tag} 
#{instance.error_message}
)
end
end


#2

You don’t need to edit any files, create a file with this code and
place it under you app initilizers folder.

Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)

On Mon, Mar 2, 2009 at 3:25 PM, Fresh M.