From 5dc64c493769fe57f23f4a2084e097c082f5256b Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 2 Mar 2016 18:28:21 +0100 Subject: [PATCH] Fix findRecord to work without passing a snapshot We use adapter.findRecord to fetch repo by slug. Using it this way was broken with one of the ember-data releases. This commit brings back the old behaviour. --- app/adapters/application.js | 6 ++++++ app/adapters/v3.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/adapters/application.js b/app/adapters/application.js index f3b4799e..58d1e98b 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -47,5 +47,11 @@ export default ActiveModelAdapter.extend({ } return this._super(...arguments); + }, + + // this can be removed once this PR is merged and live: + // https://github.com/emberjs/data/pull/4204 + findRecord(store, type, id, snapshot) { + return this.ajax(this.buildURL(type.modelName, id, snapshot, 'findRecord'), 'GET'); } }); diff --git a/app/adapters/v3.js b/app/adapters/v3.js index b693f760..7838dd4c 100644 --- a/app/adapters/v3.js +++ b/app/adapters/v3.js @@ -54,5 +54,11 @@ export default RESTAdapter.extend({ pathForType: function(modelName, id) { var underscored = Ember.String.underscore(modelName); return id ? underscored : Ember.String.pluralize(underscored); + }, + + // this can be removed once this PR is merged and live: + // https://github.com/emberjs/data/pull/4204 + findRecord(store, type, id, snapshot) { + return this.ajax(this.buildURL(type.modelName, id, snapshot, 'findRecord'), 'GET'); } });