I am trying to replace Space in a string with Line Break in Ruby on Rails,

```
name = 'john smith'

```

i have tried the following so far:

```
name.gsub!(" ", "\n")   
name.gsub!(" ", "<br>")

name.sub(" ", "\n")   
name.sub(" ", "<br>")

```

but none of the above worked.