4

I am trying to return this in it's predictable HTML way :

'Page Total ' + @total_on_page + tag('br') + 'Total All Pages'.html_safe + @total

But instead it just parses the br/ as plain text. How do I return a working HTML version of br/ ?

Expected Output :

Page Total $123123
Total All Pages $12312312   

Actual Output :

Page Total $8,296.42<br />Total All Pages$23,669.73
2
  • Expected output, current output? Commented Mar 13, 2012 at 22:33
  • 1
    I wouldn't rely on instance variables in a helper, you should probably pass them in as arguments instead. Commented Mar 13, 2012 at 22:42

1 Answer 1

10

The .html_safe at the end is applying only to the last string, not the overall string. You want something more like this:

('Page Total ' + @total_on_page + tag('br') + 'Total All Pages' + @total).html_safe
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.