From 2bec9b6c6826551fdc83b5d5b96c239335c55333 Mon Sep 17 00:00:00 2001 From: elvisortiz16 <42685920+elvisortiz16@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:43:48 -0600 Subject: [PATCH] add PATCH aka update_record_fields in README --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d06276..2c26d68 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,18 @@ Records can be inserted using the `create` method on a table: ### Updating Records Records can be updated using the `update` method on a table: - +PUT will perform a destructive update and clear all unspecified cell values. ```ruby @record[:email] = "sarahjaine@updated.com" @table.update(record) +# => #"", :email=>"sarahjaine@updated.com", :id=>"rec03sKOVIzU65eV4"> +``` + +Records can be updated using the `update_record_fields` method on a table: +PATCH only update the fields you specify, leaving the rest as they were +```ruby +@single_record_update = {email: "sarahjaine@updated.com"} +@table.update_record_fields(record.id, @single_record_update) # => #"Sarah Jaine", :email=>"sarahjaine@updated.com", :id=>"rec03sKOVIzU65eV4"> ```