- 🌱
in_order_ofcho phép order theo thứ tự chỉ định trong SQL.
User.in_order_of(:id, [1, 5, 3])
# SELECT "users".* FROM "users"
# ORDER BY FIELD("users"."id", 1, 5, 3)
# WHERE "users"."id" IN (1, 5, 3)-
🌱 source code
-
📑 FYI: Cách nà y trong SQL sẽ sort mà không sỠdụng index.
