I am using the rets gem to download real estate data.
I am trying to pass :no_records_not_an_error
to the find
command, but I can't get the syntax right:
:no_records_not_an_error => true
I've tried many different iterations using brackets, nested parentheses, with and without comma, but I have not been able to find the right syntax:
properties = client.find (:all, :no_records_not_an_error => true), {
search_type: 'Property',
class: klass,
query: status_query,
limit: 2000,
offset: offset,
select: columns_system.join(',')
}
This code DOES work without no_records..
, but it breaks with an error at the very end when there are no search results. I would like this code to return 0 or nil when there are no search results.
How about you write it like this
properties = client.find (:all), {
no_records_not_an_error: true,
search_type: 'Property',
class: klass,
query: status_query,
limit: 2000,
offset: offset,
select: columns_system.join(',')
}
Or you can simply remove no_records_not_an_error option and just write
properties.compact
This will remove all nil values in properties