How to use the ember-data.Model 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 dustinfarris / ember-django-adapter / tests / dummy / app / models / embedded-post-comment.js View on Github external
import DS from 'ember-data';

export default DS.Model.extend({
  body: DS.attr(),
  post: DS.belongsTo('post', {async: false})
});
github mharris717 / ember-cli-pagination / tests / dummy / app / models / todo.js View on Github external
import DS from 'ember-data';

var Todo = DS.Model.extend({
  name: DS.attr('string'),
  completed: DS.attr('boolean')
});

var makeFixtures = function() {
  var res = [];

  var nextId = 0;
  for (var i=0;i<11;i++) {
    res.push({id: nextId++, name: "Clean Gutters "+i, completed: false});
    res.push({id: nextId++, name: "Make Dinner "+i, completed: true});
    res.push({id: nextId++, name: "More Stuff "+i, completed: false});
  }

  return res;
};
github ember-admin / ember-cli-admin / tests / dummy / app / models / user-category.js View on Github external
import DS from 'ember-data';
var userCategory;

userCategory = DS.Model.extend({
  name: DS.attr('string'),
  zip_code: DS.attr('number'),
  description: DS.attr('string'),
  expired_at: DS.attr('date'),
  is_created: DS.attr('boolean'),
  email: DS.attr('string'),
  color: DS.attr('string'),
  avatars: DS.hasMany('avatar', {async: false}),
  fileuploads: ["avatars"]
});

export default userCategory;
github ilios / frontend / app / models / publish-event.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';

export default DS.Model.extend({
  machineIp: DS.attr('string'),
  timeStamp: DS.attr('string'),
  tableName: DS.attr('string'),
  tableRowId: DS.attr('string'),
  administrator: DS.belongsTo('user', {async: true}),
  sessions: DS.hasMany('session', {async: true}),
  programs: DS.hasMany('program', {async: true}),
  courses: DS.hasMany('course', {async: true}),
  programYears: DS.hasMany('program-year', {async: true}),
  relatedCounts: Ember.computed.collect(
    'sessions.length',
    'courses.length',
    'programs.length',
    'programYears.length'
  ),
  totalRelated: Ember.computed.sum('relatedCounts'),
github mgenev / how-to-sane / client / app / models / status.js View on Github external
import DS from 'ember-data';

export default DS.Model.extend({
    //relationships
    user: DS.belongsTo('user'),
    likes: DS.hasMany('user'),

    note: DS.attr('string'),
    state: DS.attr('string'),
    activity: DS.attr('string'),
    address: DS.attr('string'),
    location: DS.attr(),
    createdAt: DS.attr('string')

});
github m1nl / pompa / app / models / template.js View on Github external
import DS from 'ember-data';
import NumericIdModel from 'pompa/mixins/numeric-id-model';

export default DS.Model.extend(NumericIdModel, {
  name: DS.attr('string'),
  description: DS.attr('string'),
  senderEmail: DS.attr('nstring'),
  senderName: DS.attr('nstring'),
  baseUrl: DS.attr('nstring'),
  landingUrl: DS.attr('nstring'),
  reportUrl: DS.attr('nstring'),
  staticResourceUrl: DS.attr('nstring'),
  dynamicResourceUrl: DS.attr('nstring'),
  subject: DS.attr('nstring'),
  plaintext: DS.attr('nstring'),
  html: DS.attr('nstring'),
  goals: DS.hasMany('goal', { async: true }),
  resources: DS.hasMany('resource', { async: true }),
  attachments: DS.hasMany('attachment', { async: true }),
  duplicate: function() {
github ilios / frontend / app / models / learning-material.js View on Github external
import DS from 'ember-data';
import Ember from 'ember';

const {computed} = Ember;

export default DS.Model.extend({
  title: DS.attr('string'),
  description: DS.attr('string'),
  uploadDate: DS.attr('date'),
  originalAuthor: DS.attr('string'),
  userRole: DS.belongsTo('learning-material-user-role', {async: true}),
  status: DS.belongsTo('learning-material-status', {async: true}),
  owningUser: DS.belongsTo('user', {async: true}),
  sessionLearningMaterials: DS.hasMany('session-learning-material', {async: true}),
  courseLearningMaterials: DS.hasMany('course-learning-material', {async: true}),
  citation: DS.attr('string'),
  copyrightPermission: DS.attr('boolean'),
  copyrightRationale: DS.attr('string'),
  filename: DS.attr('string'),
  mimetype: DS.attr('string'),
  filesize: DS.attr('number'),
  link: DS.attr('string'),
github transitland / mobility-explorer / app / data / transitland / feed / model.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';

var Feed = DS.Model.extend({
  onestop_id: Ember.computed.alias('id'),
  operators: DS.hasMany('data/transitland/operator', { async: true }),
  url: DS.attr('string'),
  feed_format: DS.attr('string'),
  license_name: DS.attr('string'),
  license_url: DS.attr('string'),
  license_use_without_attribution: DS.attr('string'),
  license_create_derived_product: DS.attr('string'),
  license_redistribute: DS.attr('string'),
  license_attribution_text: DS.attr('string'),
  last_sha1: DS.attr('string'),
  last_fetched_at: DS.attr('string'),
  last_imported_at: DS.attr('string'),
  created_at: DS.attr('date'),
  updated_at: DS.attr('date'),
  operators_in_feed: DS.attr(),
github travis-ci / travis-web / app / models / beta-feature.js View on Github external
import Ember from 'ember';
import DS from 'ember-data';
import attr from 'ember-data/attr';

const { computed } = Ember;

export default DS.Model.extend({
  name: attr('string'),
  description: attr('string'),
  enabled: attr('boolean'),

  dasherizedName: computed('name', function () {
    return Ember.String.dasherize(this.get('name'));
  })
});
github getslash / backslash / webapp / app / models / warning.js View on Github external
import DS from "ember-data";

export default DS.Model.extend({
  message: DS.attr(),
  timestamp: DS.attr("number"),
  filename: DS.attr(),
  lineno: DS.attr("number"),
  num_warnings: DS.attr("number"),
});