You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: activerecord/CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,19 @@
1
+
* Fix `ActiveRecord::QueryMethods#in_order_of` behavior for integer enums.
2
+
3
+
`ActiveRecord::QueryMethods#in_order_of` didn't work as expected for enums stored as integers in the database when passing an array of strings or symbols as the order argument. This unexpected behavior occurred because the string or symbol values were not casted to match the integers in the database.
4
+
5
+
The following example now works as expected:
6
+
7
+
```ruby
8
+
classBook < ApplicationRecord
9
+
enum status: [:proposed, :written, :published]
10
+
end
11
+
12
+
Book.in_order_of(:status, %w[written published proposed])
13
+
```
14
+
15
+
*AlexandreRuban*
16
+
1
17
*Ignore persisted in-memory records when merging target lists.
0 commit comments