Skip to content

Conversation

@ahacking
Copy link
Contributor

This PR add the ability to control what attributes or relationships are sent back to the server as sometimes is it is undesirable to send everything back, e.g. read-only attributes or other meta data managed by the server or relationships which should not be managed through the model.

On your model you can now do:

var Person = Model.extend({
   createdAt: Ember.attr(Date, {update: false}),
   searchHits: Ember.attr(Number, {save: false}),
   friendships: Ember.hasMany('App.Friendship', {save: false})
});

The save: false option prevents the attribute ever being sent on a create or update, whilst the update: false option will never update the attribute, but does allow the value to be sent on a create. This control is intended to be independent/orthogonal of any adapter implementation since it controls the toJSON() serialisation of the model which occurs prior to the data being given to the adapter for persistence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants