And what are the ramifications of each?
I see that Model.save(), for example, automatically refreshes the Model with results from the server. I’m not sure if sync() does.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Store.sync()refreshes modified records as well (provided you have setup the server response correctly).So, technically, both methods do the same. However, in my opinion, you can use
Model.save()only in one case: when you don’t havestore. Why? Because when you have store and nevertheless you useModel.save()that’s mean that you have setup connection (proxy) configuration for bothstoreandmodel. And that’s mean that you have duplicated code which is potentially harder to maintain.So, to summarize, you use
Model.save()only if you use standalone model, without store (it may be the case when you haveformwhich is not connected to any grid. So you create standalone model for such form), and you useStore.sync()in other cases.