Class: Cuprum::Rails::Commands::UpdateOne

Inherits:
Cuprum::Rails::Command show all
Defined in:
lib/cuprum/rails/commands/update_one.rb

Overview

Command for updating an ActiveRecord record in the collection.

Instance Attribute Summary

Attributes inherited from Cuprum::Rails::Command

#collection_name, #member_name, #options, #record_class

Instance Method Summary collapse

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(entity: ) ⇒ Cuprum::Result<ActiveRecord::Base>

Updates the record in the collection.

If the collection does not already have a record with the same primary key, #call will fail and the collection will not be updated.

Parameters:

  • entity (ActiveRecord::Base) (defaults to: )

    The collection record to persist.

Returns:

  • (Cuprum::Result<ActiveRecord::Base>)

    the persisted record.



21
22
23
# File 'lib/cuprum/rails/commands/update_one.rb', line 21

validate_parameters :call do
  keyword :entity, Object
end