Skip to content

Instantly share code, notes, and snippets.

@samth
Forked from wycats/gist:4106771
Created November 18, 2012 19:07
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/4106906 to your computer and use it in GitHub Desktop.
Save samth/4106906 to your computer and use it in GitHub Desktop.
module Post {
import Comment from Comment;
import Model from DS;
class Post extends Model {}
Post.schema((post) => {
post.attr('title');
post.attr('body');
post.hasMany('comments', (args...) => Comment(args...));
})
export Post;
}
module Comment {
import Post from Post;
import Model from DS;
class Comment extends Model {}
Comment.schema((comment) => {
comment.attr('body');
comment.belongsTo('post', (args...) => Post(args...));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment