Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Model not change boolean value when send PUT request

$
0
0

@vitorbenedito wrote:

Good morning !!

We have problems with requests when send changed boolen values on the model.

When load the model from the server, the value in the model is false, but, when update the boolean to true value, the request not sends true, but sends false.

router:

actions: {
    save:function() {
      let post = this.controller.get("model");
      console.log(post.get("isPost")); // logs true
      post.save().then(() => { // request {"description":"The Post","isPost":false}
          this.transitionTo('posts');
      }).catch((error) => {
        console.log(error);
      });
    }
}

model:

import Model from './default';
import DS from 'ember-data';

export default Model.extend({
  description: DS.attr('string'),
  isPost: DS.attr('boolean')
});

I tryed to set boolean to true direct on the model, but it sends the same wrong request, send false instead true...

airline.set('isPost',true);
airline.save....

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles