Can error_message_on display multiple errors?

Is there an easy way to make error_message_on display more than just
one error message? I know I could create a custom form builder, but it
looks complicated and I would rather learn that when I have more time.

for anyone else who might come across this, i found field_error_proc.
you can over ride it and have it automatically add the errors, you can
leave the error_message_on out of your code completely. you just add
this code to an initializer.

i combined it with the second example to also stop rails from putting
those annoying divs around the fields with errors, it makes much more
sense to simply add a css class to the fields.

ActionView::Base.field_error_proc = {|html_tag, instance|
if instance.error_message.kind_of?(Array)

ActionView::Base.field_error_proc = do |html_tag, instance|
if html_tag =~ /<(input|label|textarea|select)/
error_class = ‘error’
nodes = Hpricot(html_tag)
nodes.each_child { |node| node[:class] = node.classes.push
(error_class).join(’ ') unless !node.elem? || node[:type] == ‘hidden’
|| node.classes.include?(error_class) }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs