File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
activerecord/lib/active_record/relation Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -512,13 +512,16 @@ def order!(*args) # :nodoc:
512
512
self
513
513
end
514
514
515
- # Allows to specify an order by a specific set of values. Depending on your
516
- # adapter this will either use a CASE statement or a built-in function.
515
+ # Allows to specify an order by a specific set of values.
517
516
#
518
517
# User.in_order_of(:id, [1, 5, 3])
519
518
# # SELECT "users".* FROM "users"
520
- # # ORDER BY FIELD("users"."id", 1, 5, 3)
521
519
# # WHERE "users"."id" IN (1, 5, 3)
520
+ # # ORDER BY CASE
521
+ # # WHEN "users"."id" = 1 THEN 1
522
+ # # WHEN "users"."id" = 5 THEN 2
523
+ # # WHEN "users"."id" = 3 THEN 3
524
+ # # END ASC
522
525
#
523
526
def in_order_of ( column , values )
524
527
klass . disallow_raw_sql! ( [ column ] , permit : connection . column_name_with_order_matcher )
You can’t perform that action at this time.
0 commit comments