I was expecting delete_all to be a more clever than what I’m seeing. I have an ActiveRecord::Relation which returns a bunch of records, but calling delete_all
on that relation basically ignores any where condition and joins I used to find them. I think the right behaviour would be to delete those same returned records.
Something like this:
SubscriptionTagging.joins(%q{
LEFT OUTER JOIN subscriptions ON subscriptions.id = subscription_taggings.subscription_id
}).where(‘subscriptions.id IS NULL’).delete_all
Should I open an issue on github? I’m using Rails 3.2.12.