View Full Version : belongsTo, load assocation from store not model proxy

23 Jul 2011, 9:19 AM
I have a model & store of User and Messages
( as per http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/ )

a message has a belongsTo association for the sender:

{type: 'belongsTo', model: 'app.models.User', associatedName: 'Sender', primaryKey: 'id', foreignKey: 'sender_id' }

The model app.models.User has a REST proxy configured, however I do not need to make a request to the server as this information is already in my User store (app.stores.users).

Is there a way to configure the association to use the app.stores.users store?

For all my associations the kind of behaviour I want is : hit local store, if not found then request record from server and add to store, which I assume is pretty standard for mobile apps?


24 Jul 2011, 11:44 AM
Associations are on Models not Stores so there isn't a way unless you change the Proxy on the Model which may not work as expected for you.