maccman/spine — Issue #210: Approvment to Ajax.coffee
Author: umekm
Created: 2012-02-18 11:35:01+00:00
State: open

Dear Alex,

I've extended Ajax.coffee. The idea behind this changes to give us a chance to
hook into the url generation and http method selection.

I'll added to Ajax.getUrl the action (or context) within getUrl has been called.

And I'll introduce a new method Ajax.getHttpMethod which calls httpMethod on the record or model.

Here you could see the updated and new methods on the Ajax object.

Ajax =
# CHG-MUM: Extend the URL with an action
getURL: (object,action) ->
object and object.url?(action) or object.url

# CHG-MUM: New method for resolving the HTTP method
# Use object's method httpMethod or return the defaultHttpMethod
getHttpMethod : (object,action,defaultHttpMethod) ->
object and object.httpMethod?(action) or defaultHttpMethod

I've done all changes on my local system, including the changes to the appropriate ajax calls.