Created
June 15, 2016 14:47
-
-
Save dfreeman/4e0f1c1cee27bb8d0464611a02bad8bc to your computer and use it in GitHub Desktop.
fake save
This file contains hidden or 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 RESTAdapter from 'ember-data/adapters/rest'; | |
| export default RESTAdapter.extend({ | |
| updateRecord(store, type, snapshot) { | |
| if (snapshot.adapterOptions.persist === false) { | |
| return true; | |
| } else { | |
| return this._super(...arguments); | |
| } | |
| } | |
| }); |
This file contains hidden or 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({ | |
| foo: attr('string') | |
| }); |
This file contains hidden or 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'; | |
| export default Ember.Route.extend({ | |
| beforeModel() { | |
| this.store.push({ | |
| data: { | |
| type: 'my-model', | |
| id: '12345', | |
| attributes: { | |
| foo: 'bar' | |
| } | |
| } | |
| }); | |
| }, | |
| model() { | |
| return this.store.peekRecord('my-model', '12345'); | |
| }, | |
| actions: { | |
| fakeSave() { | |
| const model = this.modelFor('application'); | |
| model.save({ adapterOptions: { persist: false } }); | |
| } | |
| } | |
| }); |
This file contains hidden or 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.9.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "2.6.0", | |
| "ember-data": "2.6.0", | |
| "ember-template-compiler": "2.6.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment