Skip to content

Commit

Permalink
Merge pull request #12 from mike-north/legacy-ember-data
Browse files Browse the repository at this point in the history
Support for ember-data 1.0.0-beta.16
  • Loading branch information
mike-north committed Sep 14, 2015
2 parents b1189fa + 4fb3373 commit 04b2515
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cache:
- node_modules

env:
- EMBER_TRY_SCENARIO=ember-1.11-ember-data-beta.16
- EMBER_TRY_SCENARIO=ember-1.11
- EMBER_TRY_SCENARIO=ember-1.12
- EMBER_TRY_SCENARIO=ember-1.13
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/build-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { assert } = Ember;

export default function buildOperationUrl(record, opPath, requestType, intance=true) {
assert('You must provide a path for instanceOp', opPath);
const { modelName } = record.constructor;
const modelName = record.constructor.modelName || record.constructor.typeKey;
let adapter = record.store.adapterFor(modelName);
let path = opPath;
let baseUrl = adapter.buildURL(modelName, intance ? record.get('id') : null, requestType);
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/collection-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import buildOperationUrl from './build-url';

export default function instanceOp(options) {
return function(payload) {
const { modelName } = this.constructor;
const modelName = this.constructor.modelName || this.constructor.typeKey;
let requestType = options.type || 'PUT';
let adapter = this.store.adapterFor(modelName);
let fullUrl = buildOperationUrl(this, options.path, requestType, false);
Expand Down
4 changes: 2 additions & 2 deletions addon/utils/member-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import buildOperationUrl from './build-url';

export default function instanceOp(options) {
return function(payload) {
const { modelName } = this.constructor;
const modelName = this.constructor.modelName || this.constructor.typeKey;
let requestType = options.type || 'PUT';
let adapter = this.store.adapterFor(modelName);
let fullUrl = buildOperationUrl(this, options.path, requestType);
return adapter.ajax(fullUrl, requestType, Ember.$.extend(options.ajaxOptions || {}, { data: payload }));
};
}
}
11 changes: 11 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ module.exports = {
name: 'default',
dependencies: { }
},
{
name: 'ember-1.11-ember-data-beta.16',
dependencies: {
'ember': '~1.11.0',
'ember-data': '1.0.0-beta.16.1'
},
resolutions: {
'ember': '~1.11.0',
'ember-data': '1.0.0-beta.16.1'
}
},
{
name: 'ember-1.11',
dependencies: {
Expand Down

0 comments on commit 04b2515

Please sign in to comment.