Hi, anyone mind taking a look at this model relationship?
So i have a database of articles defined with a post
and author
model. Each article belongs to a single author, but will also support collaborative editing by multiple authors.
Is this the correct way to structure the model? (i’ve trimmed it down for clarity).
// models/post.js
export default DS.Model.extend({
postid: DS.attr('string'),
title: DS.attr('string'),
text: DS.attr('string'),
author: DS.belongsTo('author'),
editors: DS.hasMany('author')
});
// models/author.js
export default DS.Model.extend({
uid: DS.attr('string'),
email: DS.attr('string'),
posts: DS.hasMany('post'),
// i feel something is missing here
});
I will be using ember + firebase if that’s any concern. Thx!