I’m using Ruby v.1.8.7 and Rails v.3.1.3 to create a website and I’m loading the text on the pages from a yml file. I have text inside of a <h3> tag but I want the third sentence to be placed on a separate line without having to do an explicit check in the html.
For instance, I have:
<h3><%= Settings.text_from_yml %></h3>
in my view and text_from_yaml looks like:
This is the first sentence. This is the second. And lastly, the third.
inside the yml file. Is there a way I can place a line break in the string inside the yml file to guarantee the third sentence will be on its own line? I’ve tried placing <br /> before the third line but that just outputs the text “<br /> And lastly, the third.”
I’ve also tried doing
<h3><%= Settings.text_from_yml.html_safe %></h3>
but that didn’t do what I wanted. Is there some other way to accomplish this?
1 Answer