how to break line in ruby on rails after X characters? -
i using code display headline if there one
<%= @user.headline if @user.headline? %>
i have limited 100 characters. how can break headline after 50 characters , display broken part below? planning have them centered in 2 lines.
for example:
if headline goes on 100 characters want display this
display:
if headline goes on 100 characters then
i want display this
you use word_wrap text helper:
include actionview::helpers::texthelper # or in controller # helper :text word_wrap(@user.headline, :line_width => 50)
Comments
Post a Comment