I need to compare two arrays in Rails but I need to ignore case. I am trying to compare the header array with the expected header array.
helper_method :check_header
def check_header(expected_header,csv_file)
header = CSV.open(csv_file, 'r') { |csv| csv.first }
valid_csv = true
if header != expected_header
$csv_error = "Header:<br> #{header} <br> Expected Header: <br> #{expected_header} "
valid_csv = false
end
return valid_csv
end
I tried .downcase but that is only for strings, not arrays. Is there a similar operator for arrays or do I have to walk through the elements of the array?