> ## Content Index
> Fetch the complete content index at: https://note.xdq.me/llms.txt
> Use this file to discover other available public pages before exploring further.

# 让部分ember-data属性不保存到服务器
- URL: https://note.xdq.me/make-ember-data-attr-not-save-to-server/
- Published: 2015-07-07T05:27:32.000Z
- Updated: 2026-10-03T03:06:11.000Z
- Author: xud6
- Tags: ember, #Import 2026-10-03 02:45

在ApplicationSerializer中添加

```
App.ApplicationSerializer = DS.RESTSerializer.extend({
  serializeAttribute: function(record, json, key, attribute) {
    if (!attribute.options.readOnly) {
      return this._super(record, json, key, attribute);
    }
  }
});

```

然后再其他model中就可以

```
App.User = DS.Model.create({
  admin: DS.attr('boolean', { readOnly: true })
})

```