Skip to content

Commit

Permalink
reverted all of the reverts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cody Mcculloch committed Aug 19, 2015
1 parent 0c99b67 commit 0e1454d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions addon/adapters/sails-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default SailsBaseAdapter.extend({
if (!record.id && message.id) {
record.id = message.id;
}
payload[pluralize(camelize(type.typeKey))] = [record];
payload[pluralize(camelize(type.modelName))] = [record];
store.pushPayload(type, payload);
},

Expand All @@ -150,7 +150,7 @@ export default SailsBaseAdapter.extend({
* @private
*/
_handleSocketRecordDeleted: function (store, type, message) {
var record = store.getById(type.typeKey, message.id);
var record = store.getById(type.modelName, message.id);
if (record && typeof record.get('dirtyType') === 'undefined') {
record.unloadRecord();
}
Expand Down Expand Up @@ -195,7 +195,7 @@ export default SailsBaseAdapter.extend({
this._scheduledSubscriptions = {};
}
// use an object and keys so that we don't have duplicate IDs
key = camelize(type.typeKey);
key = camelize(type.modelName);
if (!this._scheduledSubscriptions[key]) {
this._scheduledSubscriptions[key] = {};
}
Expand Down Expand Up @@ -227,7 +227,7 @@ export default SailsBaseAdapter.extend({
payload[k] = Object.keys(data[k]);
this._listenToSocket(k);
}
self.debug(fmt('asking the API to subscribe to some records of type %@', Ember.keys(data).join(', ')));
self.debug(fmt('asking the API to subscribe to some records of type %@', Object.keys(data).join(', ')));
// ask the API to subscribe to those records
this.fetchCSRFToken().then(function () {
self.checkCSRF(payload);
Expand Down
8 changes: 4 additions & 4 deletions addon/mixins/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ var StoreMixin = Ember.Mixin.create({
* @method push
* @inheritDoc
*/
push: function (typeName/*, data, _partial*/) {
push: function (result) {
var res = this._super.apply(this, arguments), id, type, adapter;
if (this._pushSubscribes && res && (id = res.get('id'))) {
type = this.modelFor(typeName);
adapter = this.adapterFor(type);
if (result.data && res && (id = res.get('id'))) {
type = this.modelFor(result.data.type);
adapter = this.adapterFor(type.modelName);
if(adapter instanceof SailsSocketAdapter)
{
adapter._scheduleSubscribe(type, id);
Expand Down
10 changes: 5 additions & 5 deletions addon/serializers/sails.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
* @method extractArray
* @inheritDoc
*/
extractArray: blueprintsWrapMethod(function (store, primaryType, payload) {
normalizeArrayResponse: blueprintsWrapMethod(function (store, primaryType, payload) {
var newPayload = {};
newPayload[pluralize(primaryType.typeKey)] = payload;
return this._super(store, primaryType, newPayload);
Expand All @@ -47,7 +47,7 @@ var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
* @method extractSingle
* @inheritDoc
*/
extractSingle: blueprintsWrapMethod(function (store, primaryType, payload, recordId) {
normalizeSingleResponse: blueprintsWrapMethod(function (store, primaryType, payload, recordId) {
var newPayload;
if (payload === null) {
return this._super.apply(this, arguments);
Expand All @@ -62,7 +62,7 @@ var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
* @method extractDeleteRecord
* @inheritDoc
*/
extractDeleteRecord: blueprintsWrapMethod(function (store, type, payload, id, requestType) {
normalizeDeleteRecordResponse: blueprintsWrapMethod(function (store, type, payload, id, requestType) {
return this._super(store, type, null, id, requestType);
}),

Expand All @@ -73,7 +73,7 @@ var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
*/
serializeIntoHash: blueprintsWrapMethod(function (data, type, record, options) {
var json;
if (Ember.keys(data).length > 0) {
if (Object.keys(data).length > 0) {
this.error(
fmt('trying to serialize multiple records in one hash for type %@', type.typeKey),
data
Expand All @@ -100,7 +100,7 @@ var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
* @method extract
* @inheritDoc
*/
extract: function (store, type/*, payload, id, requestType*/) {
normalizeResponse: function (store, type/*, payload, id, requestType*/) {
var adapter, typeKey, isUsingSocketAdapter;
// this is the only place we have access to the store, so that we can get the adapter and check
// if it is an instance of sails socket adapter, and so register for events if necessary on that
Expand Down

0 comments on commit 0e1454d

Please sign in to comment.