Skip to content

Instantly share code, notes, and snippets.

@samth
Forked from wycats/gist:4106771
Created November 18, 2012 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samth/4106878 to your computer and use it in GitHub Desktop.
Save samth/4106878 to your computer and use it in GitHub Desktop.
module Post {
import Comment from Comment;
import Model from DS;
export get Post() { return _Post; }
class _Post extends Model {}
_Post.schema((post) => {
post.attr('title');
post.attr('body');
post.hasMany('comments', Comment);
})
}
module Comment {
import Post from Post;
import Model from DS;
export class Comment extends Model {}
Comment.schema((comment) => {
comment.attr('body');
comment.belongsTo('post', Post);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment