Skip to content

Commit

Permalink
Add CHANGELOG and fix method doc
Browse files Browse the repository at this point in the history
  • Loading branch information
igordepolli committed May 9, 2024
1 parent 9d2a29f commit 26c2265
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Add option `only_values` on `in_order_of` to allow put some values as priority in the sorting without filter results by this values.

*Igor Depolli*

* Fix `index_errors` having incorrect index in association validation errors.

*lulalala*
Expand Down
3 changes: 2 additions & 1 deletion activerecord/lib/active_record/relation/query_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,14 @@ def order!(*args) # :nodoc:
# # WHEN "conversations"."status" = 0 THEN 3
# # END ASC
#
# +only_values+ can be set to +false+ to include all scope instead of only the ones specified in +values+.
# +only_values+ can be set to +false+ to include all results instead of only the ones specified in +values+.
#
# Conversation.in_order_of(:status, [:archived, :active], only_values: false)
# # SELECT "conversations".* FROM "conversations"
# # ORDER BY CASE
# # WHEN "conversations"."status" = 1 THEN 1
# # WHEN "conversations"."status" = 0 THEN 2
# # ELSE 3
# # END ASC
#
def in_order_of(column, values, only_values: true)
Expand Down

0 comments on commit 26c2265

Please sign in to comment.