Skip to content

Commit

Permalink
added CSRF helper to rails guide documentation. Closes #11615. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Mar 8, 2014
1 parent 62e8145 commit 2883cb9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions guides/source/action_view_overview.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ end


Sanitizes a block of CSS code. Sanitizes a block of CSS code.


#### strip_links(html) #### strip_links(html)
Strips all link tags from text leaving just the link text. Strips all link tags from text leaving just the link text.


```ruby ```ruby
Expand All @@ -1568,9 +1568,9 @@ strip_links('Blog: <a href="http://myblog.com/">Visit</a>.')
# => Blog: Visit. # => Blog: Visit.
``` ```


#### strip_tags(html) #### strip_tags(html)


Strips all HTML tags from the html, including comments. Strips all HTML tags from the html, including comments.
This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner. This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner.


```ruby ```ruby
Expand All @@ -1585,6 +1585,22 @@ strip_tags("<b>Bold</b> no more! <a href='more.html'>See more</a>")


NB: The output may still contain unescaped '<', '>', '&' characters and confuse browsers. NB: The output may still contain unescaped '<', '>', '&' characters and confuse browsers.


### CsrfHelper

Returns meta tags "csrf-param" and "csrf-token" with the name of the cross-site
request forgery protection parameter and token, respectively.

```html
<%= csrf_meta_tags %>
```

These are used to generate the dynamic forms that implement non-remote links
with `:method`.

Note that regular forms generate hidden fields, and that Ajax calls are
whitelisted, so they do not use these tags.

More details can be found in the [Rails Security Guide](security.html).


Localized Views Localized Views
--------------- ---------------
Expand Down

0 comments on commit 2883cb9

Please sign in to comment.