Eliminare definitivamente i post eliminati in blocco?

Bene, grazie a @pfaffman ho identificato i post pertinenti usando questo:

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

Ottengo questo output:

[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>,
ecc.

Tuttavia, non riesco a capire come applicare destroy_all a questa selezione.

Questo potrebbe aiutare (a mio beneficio):

Qualsiasi suggerimento?

1 Mi Piace