File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1818 - ' 5.2.6'
1919 - ' 6.0.4'
2020 - ' 6.1.4'
21+ - ' 7.0.0'
2122 exclude :
2223 - ruby_version : ' 3.0'
2324 rails_version : ' 5.2.6'
25+ - ruby_version : ' 2.6'
26+ rails_version : ' 7.0.0'
2427
2528 name : Ruby ${{ matrix.ruby_version }} / Rails ${{ matrix.rails_version }}
2629
Original file line number Diff line number Diff line change @@ -33,11 +33,21 @@ def failed_message(options = {})
3333 limit = options [ :limit ] || failed . count
3434 failed . first ( limit ) . map do |record |
3535 errors = record . errors
36- failed_values = errors . keys . map do |key |
36+ failed_values = attribute_names_for ( errors ) . map do |key |
3737 key == :base ? nil : record . public_send ( key )
3838 end
3939 errors . full_messages . zip ( failed_values ) . map { |ms | ms . compact . join ( ' - ' ) } . join ( ', ' )
4040 end . join ( ' ; ' )
4141 end
42+
43+ private
44+
45+ def attribute_names_for ( errors )
46+ if Gem ::Version . new ( Rails . version ) >= Gem ::Version . new ( '7.0' )
47+ errors . attribute_names
48+ else
49+ errors . keys
50+ end
51+ end
4252 end
4353end
You can’t perform that action at this time.
0 commit comments