Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Snapshot#serialize method #3148

Merged
merged 1 commit into from
Jun 3, 2015
Merged

add Snapshot#serialize method #3148

merged 1 commit into from
Jun 3, 2015

Conversation

yratanov
Copy link
Contributor

@yratanov yratanov commented Jun 2, 2015

@return {Object} an object whose values are primitive JSON values only
*/
serialize: function(options) {
return this.record.store.serializerFor(this.modelName).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just say this.record.serialize() and pass options

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought snapshot.serialize should serialize data from snapshot, not from underlying record. See my test below it won't pass if I do as you wrote.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.
Can you then make store.serialize use snapshot.serialize instead of repeating code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igorT done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please make this 1 line, I don't think we do this for lines this short

@igorT
Copy link
Member

igorT commented Jun 2, 2015

Can you please squash, and I'll merge


post.set('title', 'New Title');

deepEqual(snapshot.serialize(), { author: undefined, title: 'Hello World' }, 'shapshot serializes correctly')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add an additional assert and pass options?

* fixes #3144

use Snapshot#serialize in Store#serialize
@yratanov
Copy link
Contributor Author

yratanov commented Jun 3, 2015

@igorT squashed
@wecc added

PS: where can I see your style guides? except this https://github.com/emberjs/data/blob/master/CONTRIBUTING.md

@wecc
Copy link
Contributor

wecc commented Jun 3, 2015

LGTM 👍

@yratanov There's a style guide at https://github.com/emberjs/ember.js/blob/master/STYLEGUIDE.md

igorT added a commit that referenced this pull request Jun 3, 2015
@igorT igorT merged commit 3897ea1 into emberjs:master Jun 3, 2015
@igorT
Copy link
Member

igorT commented Jun 3, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement snapshot.serialize()
3 participants