ruby on rails - Conflict resolution when sync Backbone models to server -
most of single page browser application supposed "collaborative" means several people can edit same document or object simultaneously (think google docs). i'm trying implement collaborative application using backbone.js , rails on backend. understand how backbone model sync works, wonder best practice handle conflicts resolution?
this example: user updates field "author" of book , backbone.js model "book" sends sync request server... else updated field this book second ago. how handle situation? there common practices / frameworks / libraries handle conflicts?
sign data confirm validity:
creation of record on back-end:
{ "author": "ernest hemingway", "signature": "8332164f91b31973fe482b82a78b3b49" }
then when retrieves record, signature retrieved along. when edits record signature sent back-end. if signature matches in db, it's valid edit , back-end generates new signature record , saves it. if signature not match means else did edit in mean-time.
Comments
Post a Comment