You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The “Example functionality” section of this wiki page — https://github.com/samvera/valkyrie/wiki/Optimistic-Locking — doesn't demonstrate what it is intended to, since the initial resource is only instantiated, not persisted. Hence the two 'change_set_persister.save' lines in the body of the example don’t create a StaleObjectError . Rather they create (persist) two different instances of the resource.
I'll provide a proposed alternative code example in a comment.
The text was updated successfully, but these errors were encountered:
Actually, I think that all that's needed is to add this line resource = Valkyrie.config.metadata_adapter.persister.save(resource: resource) after the existing resource = MyLockingResource.new(title: "test title 1") line, so that the first block looks like this ...
# Create a resource
resource = MyLockingResource.new(title: "test title 1")
resource = Valkyrie.config.metadata_adapter.persister.save(resource: resource)
The “Example functionality” section of this wiki page — https://github.com/samvera/valkyrie/wiki/Optimistic-Locking — doesn't demonstrate what it is intended to, since the initial resource is only instantiated, not persisted. Hence the two 'change_set_persister.save' lines in the body of the example don’t create a StaleObjectError . Rather they create (persist) two different instances of the resource.
I'll provide a proposed alternative code example in a comment.
The text was updated successfully, but these errors were encountered: