File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,12 @@ def each_array(&block)
110
110
def each_instance ( klass = nil , &block )
111
111
klass ||= @type
112
112
self . each_tuple do |row |
113
- klass . send ( :instantiate , row )
113
+ if ::ActiveRecord ::VERSION ::MAJOR < 4
114
+ model = klass . send ( :instantiate , row )
115
+ else
116
+ @column_types ||= column_types
117
+ model = klass . send ( :instantiate , row , @column_types )
118
+ end
114
119
block . call ( model )
115
120
end
116
121
end
@@ -139,7 +144,12 @@ def each_instance_batch(klass=nil, &block)
139
144
klass ||= @type
140
145
self . each_batch do |batch |
141
146
models = batch . map do |row |
142
- klass . send ( :instantiate , row )
147
+ if ::ActiveRecord ::VERSION ::MAJOR < 4
148
+ model = klass . send ( :instantiate , row )
149
+ else
150
+ @column_types ||= column_types
151
+ model = klass . send ( :instantiate , row , @column_types )
152
+ end
143
153
end
144
154
block . call ( models )
145
155
end
You can’t perform that action at this time.
0 commit comments