Skip to content

Instantly share code, notes, and snippets.

@digitalplaywright
Created May 27, 2014 20:53
Show Gist options
  • Save digitalplaywright/8d438f66cc0e5d042946 to your computer and use it in GitHub Desktop.
Save digitalplaywright/8d438f66cc0e5d042946 to your computer and use it in GitHub Desktop.
var Post = DS.Model.extend({
title: DS.attr('string'),
details: DS.attr('string'),
user: DS.belongsTo('user')
});
export default Post;
class PostSerializer < ActiveModel::Serializer
attributes :id, :title, :details, :user_id
end
var User = DS.Model.extend({
email: DS.attr('string'),
posts: DS.hasMany('post')
});
export default User;
class UserSerializer < ActiveModel::Serializer
attributes :id, :email
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment