method

in_order_of

Importance_1
v7.0.0 - Show latest stable - 0 notes - Class: ActiveRecord::QueryMethods
in_order_of(column, values) public

Allows to specify an order by a specific set of values. Depending on your adapter this will either use a CASE statement or a built-in function.

User.in_order_of(:id, [1, 5, 3])
# SELECT "users".* FROM "users" ORDER BY FIELD("users"."id", 1, 5, 3)
Show source
Register or log in to add new notes.