Skip to content

joelcogen/airtable-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AirtableRails

AirtableRails is an easy and safe way to access Airtable. It handles client creation and app selection. Write methods are restricted to production and will write to log in other environments.

Usage

ENV["AIRTABLE_API_KEY"] = "key1234567890"
ENV["AIRTABLE_APP_ID"] = "app1234567890"

table = AirtableRails::Table.new("Table name")

table acts like an Airtable::Table as described here: https://github.com/Airtable/airtable-ruby.

create_from_hash

Instead of creating records in two steps:

record = Airtable::Record.new(:name => "Sarah Jaine", :email => "sarah@jaine.com")
table.create(record)

you can use create_from_hash to do both in a single call:

table.create_from_hash(:name => "Sarah Jaine", :email => "sarah@jaine.com")

Enabling write methods in other environments

By default, write methods (create, update, destroy) only call Airtable if the Rails environment is production.

You can disable this behavior by passing the force_write option to the initializer:

table = AirtableRails::Table.new("Table name", force_write: true)

About

Airtable client from Rails

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages