Commit 8cc4716
committed
Fix Type#cast to handle symbol values correctly in Rails 8.0 bulk operations
Rails 8.0 changed how Type#cast is used during insert_all/upsert_all operations,
causing symbol enum values (e.g., :active) to fail. The previous implementation
always delegated to @subtype.cast first, which could incorrectly transform
symbol values before looking them up.
This fix:
- First attempts to find the enumerize value directly with the input value
- Only delegates to @subtype.cast if the direct lookup fails
- Ensures both symbol values (:active) and their database representations (1)
work correctly
This maintains backward compatibility while fixing bulk operations in Rails 8.0.1 parent bd03b76 commit 8cc4716
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
126 | 127 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
0 commit comments