You could simply this:

```ruby
bad_associations = associations.each_with_object([]) do |association, bad_associations|
  bad_associations << association if !association.options.key?(:through) && !association.options.key?(:dependent)
end  
```