Reputation: 301
I have some text with a link_to
, say "Hello 1 Hello 2 Hello 3"
. I need the string to be a link that looks like the following:
Hello 1
Hello 2
Hello 3
I'm working in Ruby/Haml and cannot seem to accomplish this. Any idea how? I tried concatenating "\n"
within the string, and it does not seem to work either.
Upvotes: 2
Views: 8364
Reputation: 2709
I would suggest thinking about the HTML needed to put three bits of text onto three separate lines. You could use <p> tags or <br> tags or <div> tags (or even others if you use a bit of CSS). Perhaps something like this would work:
= link_to some_path do
Hello 1
%br
Hello 2
%br
Hello 3
or maybe this:
= link_to some_path do
%p
Hello 1
%p
Hello 2
%p
Hello 3
Upvotes: 5
Reputation: 24337
I would use something like:
= link_to "Hello 1<br>Hello 2<br>Hello 3".html_safe, url
Upvotes: 2