mardi 28 avril 2015

Ember-data relation model with controller

export default DS.Model.extend({
   slug: DS.attr("string"), 
   title: DS.attr("string"),
   body: DS.attr("string"),
   sum:  DS.attr("string"),
   human_time : DS.attr("timestamp"),
   status: DS.attr("number"),
});

This is my model while getting articles from an api, But the problem begins with post request.

Cause human_time and sum is creating by api server, not by ember. When i try to send a post request without human_time and sum, It's giving error to not getting them.

Example error:

[Error] Error: Assertion Failed: Unable to find transform for 'timestamp'

I can send via hidden input or hardcode them while sending in controller, but there are huge data to send (approx. 50 fields), how can i ignore them all? how can i tell the ember that you don't need anything except this ones.




Aucun commentaire:

Enregistrer un commentaire