¿Eliminar publicaciones eliminadas permanentemente en bloque?

Bueno, gracias a @pfaffman he identificado las publicaciones relevantes usando esto:

Post.find_by_sql("select id from posts where topic_id not in (select id from topics)")

Obtengo esta salida:

[1] pry(main)> Post.find_by_sql(“select id from posts where topic_id not in (select id from topics)”)
=> [#<Post:0x000055df30d4ee90 id: 150>,
#<Post:0x000055df2e538ff0 id: 51097>,
#<Post:0x000055df2e50ba28 id: 83>,
#<Post:0x000055df2e4ee8b0 id: 40636>,
#<Post:0x000055df2e4a92d8 id: 62562>,
#<Post:0x000055df2e4b7978 id: 13522>,
etc.

Sin embargo, no puedo averiguar cómo aplicar destroy_all a esta selección.

Esto podría ayudar (para mi propio beneficio):

¿Alguna sugerencia?

1 me gusta