Skip to content

Commit e2c60f3

Browse files
committed
Fix regression in ActiveRecord::Result#column_type
When a column type is nil in the original column_types array, the new implementation was returning nil instead of falling back to the default type. This caused "undefined method 'deserialize' for nil" errors when accessing attributes.
1 parent df1721c commit e2c60f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activerecord/lib/active_record/result.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ def column_types
163163
@types_hash ||= begin
164164
types = {}
165165
@columns.each_with_index do |name, index|
166-
types[name] = types[index] = @column_types[index]
166+
type = @column_types[index] || Type.default_value
167+
types[name] = types[index] = type
167168
end
168169
types.freeze
169170
end

0 commit comments

Comments
 (0)