I'm inside of a DS.Model
-extending class and want to get the current adapter instance. I found some code here:
App.__container__.lookup('adapter:application')
But it looks quite hacky and I'm wondering whether there's a more correct way.
This would be a bit better, since you're getting the exact adapter for the model (whether that's ThisModelAdapter, ApplicationAdapter, etc.)
this.store.adapterFor(this.constructor.typeKey)
It appears that the APIs have changed since sheldonnbbaker answered. But in Ember 2.1 the following will do the same thing:
this.store.adapterFor(this.constructor.modelName)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With