Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #89 from henrik/patch-1

FAQ: don't include all Rack::Utils just for h().
  • Loading branch information...
commit ef2124fe15dc85792b744257052a88250ca6fa0b 2 parents 6346b79 + c5b071c
@rkh rkh authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 faq.markdown
View
9 faq.markdown
@@ -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:
Please sign in to comment.
Something went wrong with that request. Please try again.