Description
Hi,
Looking at the API docs, it seems that Airtable should be able to support sorting via multiple columns via the API:
A list of sort objects that specifies how the records will be ordered. Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either "asc" or "desc". The default direction is "asc".
But I'm noticing that the records
method (among others) in lib/airtable/table.rb
seems to hard-code sort at one parameter:
def records(options={})
options["sortField"], options["sortDirection"] = options.delete(:sort) if options[:sort]
results = self.class.get(worksheet_url, query: options).parsed_response
RecordSet.new(results)
end
I've tried simply commenting out the first line of that method and passing my own sort object (ie sort: [{field: 'fieldName', direction: :asc}]
, but likely due to my unfamiliarity with HTTParty or the Airtable API, I can't figure out how to pass multiple sort objects through the records
method.
Basically: I would have submitted a pull request to adjust this method to allow multiple sort, but I can't figure it out :/ Hopefully you know more than me on the topic.
Thanks!