Skip to content

Instantly share code, notes, and snippets.

View Subtletree's full-sized avatar

Ryan Scott Subtletree

  • Wellington, New Zealand
View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
addName: function() {
if (this.get("name")) {
const newName = this.get("name");
const newRecord = this.store.createRecord("info", { name: newName });
@Subtletree
Subtletree / adapters.application.js
Last active August 30, 2018 01:03 — forked from YoranBrondsema/adapters.application.js
Non-async relationship bug (3.2.1)
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();
import Service from '@ember/service';
import fetch from 'fetch';
export default Service.extend({
session: service(),
request({ url, method, cache, headers = {}, contentType, body } = {}) {
headers = this._processHeaders(headers);
return fetch(url, {
method,
@Subtletree
Subtletree / controllers.application.js
Last active August 10, 2018 01:17
cp validations parentAttribute
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
applicationController: Ember.inject.controller('application'),
config: Ember.computed.reads('applicationController.config'),
stats: Ember.computed.reads('applicationController.model.stats'),
chartOptions: Ember.computed("model.hashrate", {
get() {
console.log(this.get('model'));
var e = this,
@Subtletree
Subtletree / models.car.js
Last active March 27, 2018 03:24 — forked from ispiders/controllers.application.js
polymorphic example
import DS from 'ember-data';
import Ember from 'ember';
import { belongsTo, hasMany } from "ember-data/relationships";
export default DS.Model.extend({
make: DS.attr('string'),
owner: belongsTo('owner', { polymorphic: true })
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
templateString: 'Template string {{a}}'
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});