In several adapters, I need to modify the urls of a belongsTo relationship based on the query params. The original urls are received in a links object.
For example, here are my adapters:
App.FirstAdapter = App.ActiveModelAdapter.extend
findBelongsTo: (store, snapshot, url) ->
controller = store.container.lookup('controller:first')
url += "?someParam=#{controller.someParam}"
@_super(store, snapshot, url)
App.SecondAdapter = App.ActiveModelAdapter.extend
findBelongsTo: (store, snapshot, url) ->
controller = store.container.lookup('controller:second')
url += "?someParam=#{controller.someParam}"
@_super(store, snapshot, url)
The problem comes when trying to lookup a controller in two different adapters. I get the error Uncaught Error: Cannot re-register: store:main, as it has already been looked up.
I get the above error even if I'm looking up the same controller.
So my question is, is the above a proper way of looking up controller properties in an adapter? And if so, how can I resolve the error I'm getting?
Aucun commentaire:
Enregistrer un commentaire