Airtable ruby gem and tablenames with spaces


#1

Hi I’m trying to use the airtable ruby gem and have run into a problem. If the table name contains spaces I cannot retrieve or add records. If I use a table name without spaces it works. I tried replacing the space with %20 but it didn’t help.

require 'airtable’
require ‘active_support/all’

client = Airtable::Client.new(“API_KEY”)
table = client.table(“APP_ID”, “‘Test Table’”)
records = table.records
print “#{records.count} records found\n"
record = Airtable::Record.new(“Creation Date” => Date.today.to_s, “Name” => “P-Town Giants”, “Email” => "ptown@gmail.com”, “Type” => “Team”)
res = table.create(record)
print res unless res

UPDATE: I’ve found the problem. the worksheet_url protected method in table.rb uses CGI::escape to escape “special” characters. Problem is it replaces space characters with ‘+’ where is should be replaced with %20 for the URL path.

I’ve opened an issue in github.