diff --git a/activerecord/test/cases/relation/field_ordered_values_test.rb b/activerecord/test/cases/relation/field_ordered_values_test.rb index 42424a62c496..f5544b33e81f 100644 --- a/activerecord/test/cases/relation/field_ordered_values_test.rb +++ b/activerecord/test/cases/relation/field_ordered_values_test.rb @@ -134,7 +134,7 @@ def test_in_order_of_with_array_values_with_nil Book.create!(format: "digital") order = ["ebook", ["paperback", nil, "digital"], "letter"] - books = Book.in_order_of(:format, order).order(format: :desc) + books = Book.in_order_of(:format, order).order(Book.arel_table[:format].desc.nulls_last) assert_equal(["ebook", "paperback", "digital", nil, "letter"], books.map(&:format)) end end