mercredi 17 juin 2015

Ember Adapter Dynamic Path Using pathForType

I'm extending an adapter:

import config from '../config/environment';
import Firebase from 'firebase';
import Ember from 'ember';
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
  pathForType: function(type) {
    return "posts/" + this.get("session.auth.uid") + "/causeRecs";
  }
});

I would like the adapter to also be able to dynamically set the pathForType using a property of the record to be saved ( record_A ):

return "posts/" + this.get("session.auth.uid") + "/causeRecs/" + this.get("record_A.path");

How to gain access to the property of the record being saved (record_A)?

Aucun commentaire:

Enregistrer un commentaire