Skip to content

Commit

Permalink
adding more documentation for $.restSetup
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Lassek committed Sep 16, 2010
1 parent 284b8be commit 8220038
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.markdown
Expand Up @@ -95,4 +95,18 @@ There is a global object called $.restSetup that you can modify in your applicat
`$.restSetup.csrf` is an object that contains the token to be passed back to the server for `POST` requests. Either set `$.restSetup.csrf.authenticity_token`
however you like, or you can replace `$.restSetup.csrf` entirely with your own name-value pair. The csrf object will be added to all non-GET requests.

`$.restSetup.methodParam` can be changed if you pass back the REST method differently. Defaults to `_method`.
`$.restSetup.methodParam` can be changed if you pass back the REST method differently. Defaults to `_method`.

Example:

$.extend($.restSetup, {
methodParam: 'action',
csrf: {
'_csrf': encodeURIComponent(AUTH_TOKEN)
}
});

$.destroy('/tasks/54');
// => [POST] /tasks/54
// => action: delete
// => _csrf: K06+3rRMlMuSoG60+Uw6UIo6UsZBbtIIPu2GaMbjf9s=

0 comments on commit 8220038

Please sign in to comment.