How to use the active-model-adapter.ActiveModelSerializer.extend function in active-model-adapter

To help you get started, we’ve selected a few active-model-adapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alphasights / ember-scrollable / app / serializers / interaction.js View on Github external
import { ActiveModelSerializer } from 'active-model-adapter';

export default ActiveModelSerializer.extend({
  isNewSerializerAPI: true,

  serializeBelongsTo: function(snapshot, json, relationship) {
    if (!['primaryContact'].contains(relationship.key)) {
      this._super(snapshot, json, relationship);
    }
  }
});
github emberobserver / client / app / serializers / addon.js View on Github external
import { ActiveModelSerializer } from 'active-model-adapter';

export default ActiveModelSerializer.extend({
  isNewSerializerAPI: true,
  serializeHasMany(record, json, relationship) {
    let { key } = relationship;
    if (key === 'categories') {
      json[key] = (record.hasMany(key) || []).mapBy('id');
    } else {
      this._super(...arguments);
    }
  }
});
github alphasights / ember-scrollable / app / serializers / application.js View on Github external
import { ActiveModelSerializer } from 'active-model-adapter';

export default ActiveModelSerializer.extend({
  isNewSerializerAPI: true,

  serializeAttribute: function(record, json, key, attribute) {
    if (!['createdAt', 'updatedAt'].contains(attribute.name)) {
      this._super(record, json, key, attribute);
    }
  }
});
github coala / git-task-list / app / serializers / application.js View on Github external
import { ActiveModelSerializer } from 'active-model-adapter';

export default ActiveModelSerializer.extend({
  singularModelName: 'issue',
  normalizeArrayResponse(store, primaryModelClass, payload) {
    payload[this.singularModelName] = payload.items;
    delete payload.items;
    delete payload.total_count;
    delete payload.incomplete_results;
    return this._super(...arguments)
  },
});

active-model-adapter

Adapters and Serializers for Rails's ActiveModel::Serializers

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis