How to use the ember-data/model.extend function in ember-data

To help you get started, we’ve selected a few ember-data 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 esbanarango / ember-model-validator / tests / dummy / app / models / specifics / for-numericality.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../../mixins/model-validator';

export default Model.extend(Validator, {
  anInteger: attr('number'),
  anIntegerLessThan4: attr('number'),
  anIntegerGreaterThan4: attr('number'),
  anIntegerGreaterThanOrEqual7: attr('number'),
  anIntegerLessThanOrEqual6: attr('number'),
  aTenNumber: attr('number'),
  anOddNumber: attr('number'),
  anEvenNumber: attr('number'),
  anOptionalNumber: attr('number'),

  init() {
    this._super(...arguments);
    this.validations = {
      anInteger: {
        numericality: { onlyInteger: true }
      },
github esbanarango / ember-model-validator / tests / dummy / app / models / specifics / for-presence.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../../mixins/model-validator';

export default Model.extend(Validator, {
  fullName: attr('string'),
  fruit: attr('string'),
  color: attr('string'),

  init() {
    this._super(...arguments);
    this.validations = {
      fullName: {
        presence: true
      },
      fruit: {
        presence: true
      }
    };
  }
});
github ciena-frost / ember-frost-bunsen / tests / dummy / app / models / view.js View on Github external
import attr from 'ember-data/attr'
import Model from 'ember-data/model'
import {hasMany} from 'ember-data/relationships'

export default Model.extend({
  label: attr('string'),
  models: hasMany('model'),
  view: attr()
})
github ciena-frost / ember-frost-bunsen / tests / dummy / app / models / value.js View on Github external
import attr from 'ember-data/attr'
import Model from 'ember-data/model'
import {hasMany} from 'ember-data/relationships'

export default Model.extend({
  label: attr('string'),
  models: hasMany('model'),
  value: attr()
})
github Exelord / ember-custom-actions / tests / dummy / app / models / bridge.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { resourceAction } from 'ember-custom-actions';

export default Model.extend({
  name: attr(),
  burnAll: resourceAction('burn', { method: 'GET' })
});
github miragejs / ember-cli-mirage / test-apps / basic-app / app / models / things / watch.js View on Github external
import Model from 'ember-data/model';

export default Model.extend({

});
github Exelord / ember-custom-actions / tests / dummy / app / models / car.js View on Github external
import Model from 'ember-data/model';
import { customAction } from 'ember-custom-actions';

export default Model.extend({
  drive: customAction('drive'),
  clean: customAction('clean'),
  fix: customAction('fix'),

  moveAll: customAction('move-all'),
  cleanAll: customAction('clean-all'),
  fixAll: customAction('fixAll')
});
github hashicorp / consul / ui-v2 / app / models / proxy.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export const PRIMARY_KEY = 'uid';
export const SLUG_KEY = 'Node,ServiceID';
export default Model.extend({
  [PRIMARY_KEY]: attr('string'),
  ID: attr('string'),
  ServiceName: attr('string'),
  ServiceID: attr('string'),
  Node: attr('string'),
  ServiceProxy: attr(),
  SyncTime: attr('number'),
  Datacenter: attr('string'),
  Namespace: attr('string'),
});
github cowbell / splittypie / app / models / sync-job.js View on Github external
import Model from "ember-data/model";
import attr from "ember-data/attr";

export default Model.extend({
    name: attr("string"),
    payload: attr("string"),
    createdAt: attr("date", {
        defaultValue() {
            return new Date();
        },
    }),
});
github hashicorp / consul / ui-v2 / app / models / session.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export const PRIMARY_KEY = 'uid';
export const SLUG_KEY = 'ID';

export default Model.extend({
  [PRIMARY_KEY]: attr('string'),
  [SLUG_KEY]: attr('string'),
  Name: attr('string'),
  Node: attr('string'),
  CreateIndex: attr('number'),
  ModifyIndex: attr('number'),
  LockDelay: attr('number'),
  Behavior: attr('string'),
  TTL: attr('string'),
  Checks: attr({
    defaultValue: function() {
      return [];
    },
  }),
  Datacenter: attr('string'),
  Namespace: attr('string'),