inverse link is overwritten
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTAdapter.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTAdapter.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const {computed} = Ember; | |
export default Ember.Controller.extend({ | |
appName: 'Inverse Link is Overwritten' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
title: attr(), | |
user: belongsTo('user', {inverse: 'posts'}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from "ember" | |
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
const {computed} = Ember; | |
export default Model.extend({ | |
name: attr(), | |
posts: hasMany('post') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
$.mockjax({ | |
type: 'GET', | |
url: '/users', | |
responseText: { | |
users: [ | |
{ | |
id: 1, | |
name: 'Peter', | |
links: { posts: '/users/1/posts' } | |
}, | |
{ | |
id: 2, | |
name: 'Michael', | |
links: { posts: '/users/2/posts' } | |
} | |
], | |
posts: [ | |
{id: 1, title: 'Peter post 1', user: 1}, | |
{id: 4, title: 'Michael post 2', user: 2} | |
] | |
} | |
}); | |
$.mockjax({ | |
type: 'GET', | |
url: '/users/1/posts', | |
responseText: { | |
posts: [{id: 1, title: 'Peter post 1', user: 1}, | |
{id: 2, title: 'Peter post 2', user: 1}, | |
{id: 3, title: 'Peter post 3', user: 1} | |
] | |
} | |
}); | |
export default Ember.Route.extend({ | |
model: function() { | |
return this.store.findAll('user'); | |
}, | |
afterModel: function() { | |
const controller = this.controllerFor('application'); | |
const posts = this.store.peekAll('post'); | |
controller.set('posts', posts); | |
}, | |
actions: { | |
reloadHasMany: function(user) { | |
user.hasMany('posts').reload(); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTSerializer.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTSerializer.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "release", | |
"ember-data": "release", | |
"ember-template-compiler": "release", | |
"ember-testing": "release", | |
"mockjax": "https://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.6.2/jquery.mockjax.js" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment