Skip to content

Commit b9d2a6d

Browse files
authored
Merge pull request #68 from zjohl/master
Replace 'type_cast_from_column' to support Rails 6.1
2 parents acf46d5 + 9cd422e commit b9d2a6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/bulk_insert/worker.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def compose_insert_query
109109
value = @now if value == :__timestamp_placeholder
110110

111111
if ActiveRecord::VERSION::STRING >= "5.0.0"
112-
value = @connection.type_cast_from_column(column, value) if column
112+
if column
113+
type = @connection.lookup_cast_type_from_column(column)
114+
value = type.serialize(value)
115+
end
113116
values << @connection.quote(value)
114117
else
115118
values << @connection.quote(value, column)

0 commit comments

Comments
 (0)