You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and was confused about why I was getting a ArgumentError: Invalid arguments! error. As pointed out in this issue, simply calling Thing.import(things.to_a) would fix things since things would be an ActiveRecord_Relation however, I'd like to propose that .import should be more liberal in what it accepts and that this should be a valid use case.
Instead of doing strict args.last.is_a?( Array ) checks like this should instead maybe check if args.last responds to to_a and if so then calls that first.
Also, maybe we could improve these error message a bit to be more specific about why the arguments are invalid?
The text was updated successfully, but these errors were encountered:
Hi there, I was recently trying to do something like
and was confused about why I was getting a
ArgumentError: Invalid arguments!
error. As pointed out in this issue, simply callingThing.import(things.to_a)
would fix things sincethings
would be anActiveRecord_Relation
however, I'd like to propose that.import
should be more liberal in what it accepts and that this should be a valid use case.Instead of doing strict
args.last.is_a?( Array )
checks like this should instead maybe check ifargs.last
responds toto_a
and if so then calls that first.Also, maybe we could improve these error message a bit to be more specific about why the arguments are invalid?
The text was updated successfully, but these errors were encountered: