I heart Ruby and Rails 6
Tonight I needed to find out if there were any rooms on Lingr that hadn't had a room image created for them. This should never happen, but some exception emails that were being generated indicated that it was happening.
In about 10 seconds, I whipped this up in the console:
Room.find(:all, :select => :id).collect(&:id).inject([]) {|r, i|
r << i if !Image.find_by_imageable_type_and_imageable_id('Room', i)
r
}
Awesome

Room.find(:all, :select => :id).collect(&:id).reject do |room| Image.find_by_imageable_type_and_imageable_id('Room', room) end