Just a follow up in case this helps anyone else:

> You could also probably put a literal "<br>" in the error message, then
> use unescape_html.

As it turns out, simple_format was wrapping everything in < p > tags,
which was causing invalid html to be generated in the error view of my
form.

So, I tried Maren's suggestion and came up with the following:

in environment.rb
require 'cgi'

Error message in model:
errors.add(field, "This field is too long.%3cbr %3eYou are using
#{self[field].length} characters out of a permitted #{permitted}.")

And in the view:
<%= CGI.unescape(error_message_on :applicant, :thesis) %>

This works just fine and produces valid markup in the form's error view.

Thanks Maren.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to