I have a Post model with the following fields:
BlogApp.Post = DS.Model.extend({
author: DS.attr('string'),
title: DS.attr('string'),
preamble: DS.attr('string'),
content: DS.attr('string'),
created: DS.attr('date'),
comments: DS.hasMany('BlogApp.Comment'),
lastUpdate: DS.attr('date')
});
After rendering, instead of the Post.content, the result is like:
<BlogApp.Post:ember272:1>
Other fields rendering are OK. I guess content
is conflicting with some internal property. I have a few questions:
- is there any workaround when the REST API has names that conflict with Ember internals?
- is there other forbidden attribute names I should be aware?
[update]
The name clash is with the controller, not with the model. It is not a definitive list but watch out for other common database column names like:
- model
- transaction
- is_new
- is_deleted
- store
- errors
I guess Ember developers not as afraid of namespace-related bugs as this poor pythonist.
BTW, Angular.js guys got it right: they always prefix API attributes and methods with $
effectively preventing this kind of bug.