-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Documentation for instance#update #400
Comments
rapito
changed the title
Yield should test if there's a block to yield to in persistence/update #160
Missing Documentation for instance#update
Dec 18, 2019
Yeah, definitely there is a lack of documentation in the project. Some aspects should be updated in Readme.md as well as in the Yard documentation. Any PR with documentation is welcomed. |
Documentation was added here #431 dynamoid/lib/dynamoid/persistence.rb Lines 594 to 641 in 555b0e7
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a duplicate of an open issue on the original repository:
Veraticus/Dynamoid#160
Also, I couldn't find any documentation where it explains the
update
usage on this gem. Even if we do need to pass a block, what is it for? It should be added to the documentation and/or readme of this repository.For what I can see in the code, from the yield block you obtain an ItemUpdater which is part of the adapter plugin for aws-sdk-v2, at the very least the readme should relay the documentation back to the aws gem if needed with how to use it.
TL;DR
The following code crashes and there's no documentation about how to handle it or use the update method.
Foo.first.update(bar: "this should be updated")
-> Raises LocalJumpError: no block given (yield) and the record is not updated.Foo.first.update(bar: "this should be updated") { |iu| puts "I'm a weird block" }
-> No error but the record is not updated at allSo by digging into the codebase I found out the following is the actual way to update things (which is kind of unnatural), which makes the method a pain to use and figure out.
Foo.first.update { |iu| iu.set bar: "this should be updated" }
-> No error and the record is finally updatedAlso please note that this is executing the
update
method on the model instance and not the class.The text was updated successfully, but these errors were encountered: