Class: Cuprum::Rails::Commands::DestroyOne
- Inherits:
-
Cuprum::Rails::Command
- Object
- Collections::Command
- Cuprum::Rails::Command
- Cuprum::Rails::Commands::DestroyOne
- Defined in:
- lib/cuprum/rails/commands/destroy_one.rb
Overview
Command for destroying an ActiveRecord record by primary key.
Instance Attribute Summary
Attributes inherited from Cuprum::Rails::Command
#collection_name, #member_name, #options, #record_class
Instance Method Summary collapse
-
#call(primary_key: ) ⇒ Cuprum::Result<Hash{String, Object}>
Finds and destroys the record with the given primary key.
Methods inherited from Cuprum::Rails::Command
#initialize, #primary_key_name, #primary_key_type, subclass
Constructor Details
This class inherits a constructor from Cuprum::Rails::Command
Instance Method Details
#call(primary_key: ) ⇒ Cuprum::Result<Hash{String, Object}>
Finds and destroys the record with the given primary key.
The command will find the record with the given primary key and remove it from the collection. If the record is not found, the command will fail and return a NotFound error.
22 23 24 |
# File 'lib/cuprum/rails/commands/destroy_one.rb', line 22 validate_parameters :call do keyword :primary_key, Object end |