Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Twiddle
import Ember from 'ember';
import DS from 'ember-data';
import MyNativeClassModel from '../models/my-native-class-model';
import MyEmberObjectModel from '../models/my-ember-object-model';
function isModel(TestModel) {
return TestModel !== DS.Model && DS.Model.detect(TestModel);
}
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isModelNativeExtends: isModel(MyNativeClassModel),
isModelEmberObjectExtends: isModel(MyEmberObjectModel),
});
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
export default Model.extend({
});
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
export default class MyNativeClassModel extends Model {
}
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<hr>
<pre>dataAdapter.detect(DS.Model.extend())</pre>
{{isModelEmberObjectExtends}}
<hr>
<pre>dataAdapter.detect(class Foo extends DS.Model {})</pre>
{{isModelNativeExtends}}
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.0.0",
"ember-template-compiler": "3.0.0",
"ember-testing": "3.0.0"
},
"addons": {
"ember-data": "2.18.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.