diff options
author | Rajinder Yadav <devguy.ca@gmail.com> | 2010-11-09 04:31:08 -0500 |
---|---|---|
committer | Rajinder Yadav <devguy.ca@gmail.com> | 2010-11-09 04:31:08 -0500 |
commit | 26d314ed6a678e3af38d4caa3483f11f36061333 (patch) | |
tree | c66143bf964e55d5ad2c8d0562c68f3324d1dc1a /actionpack | |
parent | 4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6 (diff) | |
parent | 645f5158432b541948bcb3e3745cce18ab257df2 (diff) | |
download | rails-26d314ed6a678e3af38d4caa3483f11f36061333.tar.gz rails-26d314ed6a678e3af38d4caa3483f11f36061333.tar.bz2 rails-26d314ed6a678e3af38d4caa3483f11f36061333.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 7c877a0f57..3d276000a1 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -9,6 +9,24 @@ module ActionView # and transforming strings, which can reduce the amount of inline Ruby code in # your views. These helper methods extend Action View making them callable # within your template files. + # + # ==== Sanitization + # + # Most text helpers by default sanitize the given content, but do not escape it. + # This means HTML tags will appear in the page but all malicious code will be removed. + # Let's look at some examples using the +simple_format+ method: + # + # simple_format('<a href="http://example.com/">Example</a>') + # # => "<p><a href=\"http://example.com/\">Example</a></p>" + # + # simple_format('<a href="javascript:alert('no!')">Example</a>') + # # => "<p><a>Example</a></p>" + # + # If you want to escape all content, you should invoke the +h+ method before + # calling the text helper. + # + # simple_format h('<a href="http://example.com/">Example</a>') + # # => "<p><a href=\"http://example.com/\">Example</a></p>" module TextHelper extend ActiveSupport::Concern |