Created
May 27, 2014 20:53
-
-
Save digitalplaywright/8d438f66cc0e5d042946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Post = DS.Model.extend({ | |
title: DS.attr('string'), | |
details: DS.attr('string'), | |
user: DS.belongsTo('user') | |
}); | |
export default Post; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostSerializer < ActiveModel::Serializer | |
attributes :id, :title, :details, :user_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var User = DS.Model.extend({ | |
email: DS.attr('string'), | |
posts: DS.hasMany('post') | |
}); | |
export default User; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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