Define methodMap since it's called from within Backbone.sync
Default options, unless specified.
Default JSON-request options.
Ensure that we have a URL.
railsy_backbone (start) 
Rails CSFR Integration  
include the Rails CSRF token on HTTP PUTs/POSTs
Set X-CSRF-Token HTTP header
railsy_backbone (end)
Ensure that we have the appropriate request data.
railsy_backbone (start) 
Nested Model Attributes  
If Backbone.Model defines paramRoot, then store model attributes 
within paramRoot key-value pair. For example, book attributes 
(title, author) are nested within book key-value pair,
 var Book = Backbone.Model.extend({ 
   url: '/books',
   paramRoot: 'book' 
 });
 var book_instance = new Book({ 
   title:  'the illiad', 
   author: 'homer'
 });
The resulting HTTP POST looks like this,
 book_instance.sync();
 Started POST "/books" for 127.0.0.1
   Processing by BooksController#create as JSON
   { "book" => { "title" => "the illiad", "author" => "home", "id" => 1} }
Store model instance in JSON format.
Remove Rails unofficially reserved created_at and updated_at so 
they're included in HTTP PUT/PATCH request.
Nest model attributes within model's paramRoot key-value pair.
If model does not define a paramRoot, use the original Backbone 
implementation.
railsy_backbone (end)
For older servers, emulate JSON by encoding the request into an HTML-form.
For older servers, emulate HTTP by mimicking the HTTP method with _method
And an X-HTTP-Method-Override header.
Don't process data on a non-GET request.
If we're sending a PATCH request, and we're in an old Internet Explorer
that still has ActiveX enabled by default, override jQuery to use that
for XHR instead. Remove this line when jQuery supports PATCH on IE8.
Make the request, allowing the user to override any Ajax options.
NOTE: only overriding Backbone when
railsy_backbone (start) ... (end)is explicitly called out.Overriding Backbone.sync to implement,
- Nested model attributes
- Rails CSFR Integration