i need to create a correct respond from rails server but i dont know how.
this is the error that throws me
"WARNING: Encountered "status" in payload, but no model was found for model name "status" (resolved model name using frontend@serializer:post:.modelNameFromPayloadKey("status"))"
controller/posts/edit.js
export default Ember.Controller.extend({
actions:{
submit: function(params){
var self = this;
this.store.findRecord('post', params).then(function(post){
post.save();
self.transitionToRoute('posts');
});
}
}
});
this is the function in rails that it's hit when i save my post in ember
def update
post = Post.find(params[:id])
if post.update(strong_params)
render json: {status: "ok"}
else
render json: {status: "error"}
end
end
model/post.js
export default DS.Model.extend({
title: DS.attr("string"),
body: DS.attr("string")
});
So how i handle my json in rails to tell me when my posts could update or not
Note: The post is updated sucessfully but in my log console appear that message and i want to make it right
Aucun commentaire:
Enregistrer un commentaire