Skip to content
4 changes: 2 additions & 2 deletions lib/netsuite/support/search_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def initialize(response, result_class)
if response.body.has_key?(:record_list)
# basic search results
record_list = response.body[:record_list][:record]
record_list = [record_list] if @total_records == 1
record_list = [record_list] unless record_list.is_a?(Array)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious... why was this needed? What situation broke the existing implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have more than one page of items and the last page has only a single item.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, got it. Nice catch! Merged this into master.


record_list.each do |record|
results << result_class.new(record)
end
elsif response.body.has_key? :search_row_list
# advanced search results
record_list = response.body[:search_row_list][:search_row]
record_list = [record_list] if @total_records == 1
record_list = [record_list] unless record_list.is_a?(Array)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case this did this occur?

record_list.each do |record|
# TODO because of customFieldList we need to either make this recursive
Expand Down
Loading