Trivial Rails tip: easy html spaces

For when you don’t want to type   a dozen times, add this to application_helper.rb:
def nbsp(n=1)
    n.times.map {" "}
end

In a view:
<%= nbsp 5 %>
replaces
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

Post a Comment

Your email is never published nor shared. Required fields are marked *