Apr 12, 2018 05:43 PM
If there are any other Ruby on Rails devs out there that could help me out, I’m trying to use the airtable-ruby gem to post data from a custom form to an airtable base.
I’m new to web development, self-taught, and working alone, so I’m sure my code is a mess and I’m doing things all wrong, but I feel like I have this set up in a way that it should be working. I have as much of it stripped down to the bare bones as possible, but I still can’t figure out what’s failing.
Here’s my controller:
The form:
The log results from submitting:
My table:
I worked on this for several hours today and cannot for the life of me figure out why it won’t submit records. If you can offer any help, I’d be much obliged!
Apr 13, 2018 02:48 AM
I have not used the Ruby library in the past…As I generally use the API directly via the REST interface so you might want to give that a go…
A quick Google search for “rest api calls ruby” will give you some helpful pointers…
Each Base has its own set of “curl” calls, so you would essential need to “convert” those raw curl calls into HTTP calls using a Ruby HTTP client…
I agree its a bit of a tiresome solution, but in case I have some free time later on today I will go over your code and figure out where you are going wrong…
Apr 13, 2018 01:47 PM
Well, I couldn’t get the gem to work at all - github issues suggested other people have had trouble as well.
So I resorted to using the built in Ruby Net::HTTP.post
method and finally got it working.
Now I’m trying to figure out what types of fields I can submit data to and what kind of form helpers I can use to generate that data :persevere:
Apr 14, 2018 02:03 PM
For the benefit of future readers with this same issue - I found a gem called decanter that will transform the strings you get back from web forms into a data type you define, so that you can hit Airtable’s api to submit to number and checkbox fields :+1:t2: