ember.js - Using ember-data with a custom REST endpoint -



ember.js - Using ember-data with a custom REST endpoint -

i'd tell me how they've approached issue using custom fellow member or collection actions rest resource, e.g. put /users/:id/confirm or put /kittens/pet_all

this complex task. implement hard because outside of resourceful routes, there no assumed contract server's request/response type or structure. sucks, though, when hypothetically want pet_all kittens, regardless of outcome , must resort hacking ajax request so.

please, think of kittens...

one way i've done in past override findquery method in adapter , pass hash find method. skip buildurl method altogether.

for example, if wanted fetch collection of confirmations nested in user resource:

app.userroute = em.route.extend({ aftermodel: function(model) { promise = this.get('store').find('confirmation', userid: model.get('id')) this.controllerfor('confirmations').set('model', promise) } }); app.confirmationadapter = ds.restadapter.extend({ findquery: function(store, type, query) { confirmationsurl = this.host + '/users/' + query.userid + '/confirmations' delete query.userid homecoming this.ajax(confirmationsurl, 'get', { data: query }); } })

this should started in figuring out how handle updates.

rest ember.js ember-data

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -