Upgrade to ActiveRecord 4.1.4. Fixes deprecations and scoping problems.
Add optimistic locking via a numeric version field.

If a client fetches a document with version 1, and then tries to post the same document (with the version 1 as part of the POST data), and another client has modified the document in the meantime, the request will fail.