Method: Dynamoid::TransactionWrite#destroy
- Defined in:
- lib/dynamoid/transaction_write.rb
#destroy(model) ⇒ Dynamoid::Document
Delete a model.
Runs callbacks.
Raises Dynamoid::Errors::MissingHashKey if a partition key has value nil and raises Dynamoid::Errors::MissingRangeKey if a sort key is required but has value nil.
There are the following differences between transactional and non-transactional #destroy:
-
transactional
#destroydoesn’t supportlock_versionattribute so it will not be incremented and will not be checked to detect concurrent modification of a model andDynamoid::Errors::StaleObjectErrorexception will not be raised -
transactional
#destroydoesn’t disassociate a model from associated ones if there are association declared in the model class
655 656 657 658 |
# File 'lib/dynamoid/transaction_write.rb', line 655 def destroy(model) action = Dynamoid::TransactionWrite::Destroy.new(model, raise_error: false) register_action action end |