Gabriel Sobrinho

Results 179 comments of Gabriel Sobrinho

But that will instantiate the records into AR objects wasting memory, no?

Why not `yield yielded_relation, batch_relation` so I can get the ids or whatever? :)

Oh, I see, the pluck would still be executed. Maybe we can work with the BatchEnumerator to add a special case just for pluck?

We might use a strategy where we decide what to yield like (pseudo): ```ruby if load == :relation yielded_relation = batch_relation elsif load records = batch_relation.records ids = records.map(&:id) yielded_relation...

Yeah, too much effort for other columns and in that case probably worths to make an extra SQL. Since in my case I'm looking for the primary key anyways, your...

I'm guessing we could do `ids = batch_relation.pluck(primary_key, *extra_pluck_columns)` and yield along with the ids but too hacky.

If it's about the primary key, currently can be worked around with: ```ruby Model.in_batches do |batch| ids = batch.where_values_hash[batch.klass.primary_key] end ``` I'm using this with success so far.

Found it: ``` [2] pry(#)> puts response_headers HTTP/2 404 date: Mon, 22 Jan 2024 17:29:28 GMT content-type: text/html ``` ``` [6] pry(#)> response_headers.scan(/Content-Type: (\S+(; charset=\S+)?)/).flatten.first => nil [7] pry(#)> response_headers.scan(/Content-Type:...