Closed baarkerlounger closed 7 years ago
Ugh. Sorry for being late to the party, I've started reviewing yesterday but got distracted :( This merged code has one important problem. What if value assigned is Enumerable, but is not Array
or Range
? (Say, it is ActiveRecord::Relation
.) What user expects is it would be converted to_a
, and then inserted as a vector. What actually will happen, is pretty obscure error:
when Array, Range
would be skipped;prepare_value_for_insert
, there would be called Array(relation)
, which will do to_a
(producing array of objects)... and then multiplied by DF size, producing vector much larger than expected.@baarkerlounger can you please do a small follow-up PR which fixes this (I believe, by replacing when Array, Rang
with if respond_to?(:to_a)
) It is OK if you have no time for this, I can do it myself.
@zverok implemented your suggestion here: https://github.com/SciRuby/daru/pull/379
https://github.com/SciRuby/daru/issues/351
Enable: