Comment on page


To use CSRF, enable the pipe in your by adding the following pipe to a pipeline.
Then, insert the csrf_tag helper in your forms.

How to use CSRF with AJAX

Simply call the csrf_tag helper inside your controller and return it as part of a JSON object:
def my_action
{csrf: csrf_tag}.to_json
In your Javascript, after getting the JSON object back, refresh your CSRF tag with the one from the server.
Last modified 8mo ago