rails helper - how can I get a helper to give me a `<br/>` (or other markup)

ruby, ruby-on-rails

Solution

Use `tag(:br)` instead of `"<br/>"`.

`content_tag(:br)` creates opening and closing `br` tags and using `raw` or `html_safe` is just ugly (not to mention dangerous).

Problem

My helper works like this: ``` def some_help(in_string) in_string + " and more" end ``` But I want it do to a before the output and I keep getting the < br > characters themselves literally, i.e. not a break but what I want is a < br > that is the problem. so ``` def some_help(in_string) "<br/>" + in_string + " and more" end ``` doesn't work right.

Original source