0
votes

I have a model in ember-data defined as:

App.Note = DS.Model.extend({
  content: attribute('string'),
  createdDate: attribute('string', {
    defaultValue: function() {return new Date()}
  }),
  title: function() {
    // do stuff
  }.property('content', 'createdDate') 
});

I notice that when I create a new object with:

this.store.createRecord('note');

The title property is not computed. I assumed that the default value would trigger the property to update, but it's not. How can I get a default value to also trigger a computed property to fire?

1

1 Answers

2
votes

I believe the problem is that you are using 'content' as a property name. I would avoid using that word, as Ember tends to use it a lot itself and it can mess things up. Here is a jsbin of your code woriking: http://emberjs.jsbin.com/jebugofo/6/edit?html,css,js,output . Simply needed to get rid of that name for the property.