Commit 3af0407
committed
support proc default values in ruby 3.2
Fixes:
```
NoMethodError: undefined method `=~' for #<Proc:..
```
As
#1032
explains `=~` [was removed](https://bugs.ruby-lang.org/issues/15231) from Proc.
`Proc` are handled by [this line of
code](https://github.com/rails/rails/blob/v7.0.4.2/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb#L96)
The solution is to add a check and call `~=` only when `value` is a `String`.
I took the oportunity to also follow rubocop performance suggestions
```
Performance/StringInclude: Use String#include? instead of a regex match
with literal-only pattern.
```
Got the idea from postgresql adapter
(rails/rails@5726b1d#diff-d8e4ab5c8c59df4fc1bc85457af0d07b88bd842a287233617a97ad2436fcb842R120)1 parent 2094cab commit 3af0407
File tree
3 files changed
+11
-1
lines changed- lib/active_record/connection_adapters/sqlserver
- test/cases
3 files changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
46 | 54 | | |
0 commit comments