advanced patterns with `find_each` not yielding correct results for soft-deleted records in Rails 7
I've been struggling with this for a few days now and could really use some help. I'm dealing with I tried several approaches but none seem to work. I'm sure I'm missing something obvious here, but I'm experiencing unexpected behavior when using `find_each` with a scope that filters for soft-deleted records in my Rails 7 application... I've implemented a soft-delete feature using the `paranoia` gem, and my model looks something like this: ```ruby class Article < ApplicationRecord acts_as_paranoid end ``` Now, I want to process all articles, including those that have been soft-deleted. I tried using `find_each` as follows: ```ruby Article.with_deleted.find_each do |article| puts article.title end ``` However, it only yields the non-deleted records, and I don't see the soft-deleted articles in the output. I've also ensured that my database has records marked as deleted. The `with_deleted` scope should theoretically allow access to these records, but it seems like `find_each` is not working as expected here. To troubleshoot, I tested the `all` method: ```ruby Article.with_deleted.all.each do |article| puts article.title end ``` This correctly outputs the titles of both deleted and non-deleted articles. Why does `find_each` not behave the same way? Is there a limitation or an scenario with how `find_each` interacts with `with_deleted`? Any insights or workarounds would be greatly appreciated! This is part of a larger application I'm building. What am I doing wrong? My development environment is Linux. The stack includes Ruby and several other technologies. Any ideas how to fix this?