Skip to content

Commit

Permalink
Wrap search result in an array when there is only a single item in th…
Browse files Browse the repository at this point in the history
…e results

#82
  • Loading branch information
pospischil authored and iloveitaly committed Aug 26, 2015
1 parent ff51e63 commit 760b6d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/netsuite/support/search_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,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)

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)

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

0 comments on commit 760b6d3

Please sign in to comment.