Skip to content

Update won't work with formula/lookup fields in the table #8

@dmerand

Description

@dmerand

Hi,

I was having a ton of problems getting an existing record to update, and then I found this line in lib/airtable/records.rb:

# Airtable will complain if we pass an 'id' as part of the request body.
def fields_for_update; fields.except(:id); end

It turns out that Airtable will complain if you've got any calculated fields in the table, and it won't update :/

What I've done to fix this in my code is a monkeypatch like this:

module Airtable
  class Record
    def fields_for_update
      fields.except(:id, :FormulaField, :LookupField)
    end
  end
end

... but I wonder if there's a more elegant way to do this?

The most elegant way to fix it would be if Airtable didn't FAIL when you try to update a calculated field (or the ID), but merely sent along some kind of warning. I'll send this idea along to them as well.

Thanks!
-Donald

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions