Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
データベースに保存されているすべての無効なオブジェクトをRailsコンソールから取得することを覚えていないのは簡単な理由です。
どのようにアイデアはありますか?
モデルがウィジェットと呼ばれているとすると、次のようになります。
Widget.all.select(&:invalid?)
データが多い場合は非常に遅くなる可能性がありますが、レコードの有効性を確認する場合は、データベースからレコードを取得する必要があります。