Skip to content

Instantly share code, notes, and snippets.

@jpadilla
Created November 4, 2013 17:59
Show Gist options
  • Save jpadilla/7306653 to your computer and use it in GitHub Desktop.
Save jpadilla/7306653 to your computer and use it in GitHub Desktop.
WIP Ember.js Adapter for Sails.js
module.exports = App.ApplicationAdapter = DS.RESTAdapter.extend
init: ->
@_super()
pathForType: (type) ->
@type = type
return type
ajax: (url, method, hash) ->
adapter = this
new Ember.RSVP.Promise (resolve, reject) ->
hash.callback = (obj) ->
unless Ember.isNone obj.status
Ember.run null, reject, obj
else
result = {}
result[adapter.type] = obj
Ember.run null, resolve, result
socket.request url, hash.data, hash.callback, method.toLowerCase()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment