Skip to content

Commit

Permalink
Merge pull request #89 from henrik/patch-1
Browse files Browse the repository at this point in the history
FAQ: don't include all Rack::Utils just for h().
  • Loading branch information
rkh committed Dec 16, 2012
2 parents 6346b79 + c5b071c commit ef2124f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions faq.markdown
Expand Up @@ -245,12 +245,13 @@ And in `mailerapp.rb`:
How do I escape HTML? {#escape_html}
---------------------

Include [Rack::Utils](http://rack.rubyforge.org/doc/classes/Rack/Utils.html)
in your helpers and create an `h` alias as follows:
Use [Rack::Utils](http://rack.rubyforge.org/doc/classes/Rack/Utils.html)
in your helpers as follows:

helpers do
include Rack::Utils
alias_method :h, :escape_html
def h(text)
Rack::Utils.escape_html(text)
end
end

Now you can escape HTML in your templates like this:
Expand Down

0 comments on commit ef2124f

Please sign in to comment.