Tuesday, September 21, 2010

[Rails] Re: Add line break to custom error message

I have not been able to find a way of breaking the line, except by
breaking the message in 2 separate ones as I explained before. If you
do, please post the solution. I would like to know. Sorry I couldn't
be of much help.

On Sep 21, 5:52 pm, Jim Burgess <li...@ruby-forum.com> wrote:
> > First line<%= sanitize('<br />') -%>Second line
>
> I tried:
>
> errors.add(:thesis, "This field is too long. <%= sanitize('<br />') -%>
> You are using #{field.length} characters out of a permitted
> #{permitted}.")
>
> This produced:
> "This field is way too long. <%= sanitize('<br />') -%> You are using
> 12600 characters out of a permitted 1000."
>
> In the source code:
> Publications This field is sway too long.& l t ;%= sanitize('& l t ;br
> /& g t ;') -%& g t ;You are using 12600 characters out of a permitted
> 1000.
>
> I also tried:
> errors.add(:thesis, "This field is too long." + <%= sanitize('<br />')
> -%> + "You are using #{field.length} characters out of a permitted
> #{permitted}.")
>
> This produced a syntax error:
> /applicant.rb:505: syntax error, unexpected '<'
> ...s field is way too long." + <%= sanitize('<br />') -%> + "Y...
>
> Thanks for your help so far.
>
> --
> Posted viahttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate