diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb index 9256bf12..6c7f748c 100644 --- a/lib/netsuite/support/search_result.rb +++ b/lib/netsuite/support/search_result.rb @@ -29,7 +29,7 @@ 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) record_list.each do |record| results << result_class.new(record) @@ -37,7 +37,7 @@ def initialize(response, result_class) 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) record_list.each do |record| # TODO because of customFieldList we need to either make this recursive