Sinatra ERB Escaping

sinatra

Tue Aug 04 13:34:30 -0700 2009

Writing erb in Rails, you’re probably used to escaping HTML like this:

<%=h article.author %>

You can get this functionality in Sinatra by adding this to your helpers:

helpers do
  alias_method :h, :escape_html
end