Break Word?

On my app I allow users to post comments. I’m afraid some user might
post something like this:

“whateveeeeeeeeeeee…eeeeeeer”

This will stretch my page and mess up my entire layout. Rails’
break_word helper doesn’t work in this case, so how I avoid this,
using either Ruby or CSS?

Thanks in advance

On my app I allow users to post comments. I’m afraid some user might
post something like this:

“whateveeeeeeeeeeee…eeeeeeer”

This will stretch my page and mess up my entire layout. Rails’
break_word helper doesn’t work in this case, so how I avoid this,
using either Ruby or CSS?

You can truncate the string to a maximun length using:

<%= truncate(@comment_text,max_length) %>

Or do by your hand some code that break long words (using a space and a
minus) if they are longer than a length and then use word_wrap (it takes
the spaces into account)…