From 8220038c97daabede13a6e354cf87d7367b10359 Mon Sep 17 00:00:00 2001 From: Adam Lassek Date: Thu, 16 Sep 2010 13:33:57 -0500 Subject: [PATCH] adding more documentation for $.restSetup --- README.markdown | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 0452b8c..26955a2 100644 --- a/README.markdown +++ b/README.markdown @@ -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`. \ No newline at end of file +`$.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= \ No newline at end of file