maccman/spine — Issue #211: error and succes handlers in create/save calls
Author: ygor
Created: 2012-02-18 12:24:11+00:00
State: open

Hi,

When trying out the Raffler backbone example from the latest Railscast in Spine JS (see result here: https://github.com/ygor/spine-raffler), I encountered the problem of hooking into the success and error callbacks upon a save or create call on the model. In backbone the following was possible:

@collection.create attributes,
wait: true
success: -> $('#new_entry')[0].reset()
error: @handleError

Now how would I implement the handlers and the wait:true option in Spine? Is there any easy way, and if not, would it be an idea to follow Backbone and also allow the passing of success and error handlers in the create and save calls?

I have seen that it is possible to do a instance.bind 'ajaxSuccess' (in the docs it appears that this call should be on the class, while the code seems to indicate that its on the instance) and instance.bind 'ajaxError', but still the model gets created when the ajaxError occurs. So any Ideas on this?