Text field formatting

Hi,

I am trying to figure out how to convert line breaks to html line
breaks ie

Text is imput and saved as:
Which structures traverse above the annulus of Zinn?
A) Lacrimal nerve
B) Frontal nerve
C) Nasociliary nerve
D) CN IV
E) CN III

but, I have a text field in my show action view with the following:
<%= “#{@formatted_question[:question]}” %>

which produces:
Which structures traverse above the annulus of Zinn? A) Lacrimal nerve
B) Frontal nerve C) Nasociliary nerve D) CN IV E) CN III

The line breaks are still there, they just aren’t being converted to
HTML line breaks. I can see them when I view the source.

How can I get the line breaks back??

Thanks,
Dave

Got it! simple_format(text)

Oops.

<%= “#{@formatted_question[:question].gsub(/\n/, ‘
’).html_safe}” %>

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