class RemoveFactsWithoutSite < Mongoid::Migration
  def self.up
    Fact.all.to_a
      .keep_if{|f| !f.site || !f.site.url || f.site.url.blank?)}
      .each do |fact|

        Resque.enqueue ReallyRemoveFact, fact.id

    end
  end

  def self.down
  end
end

class RemoveFactsWithoutSite < Mongoid::Migration
  def self.up
    Fact.all.ids.each do |fact_id|
      fact = Fact[fact_id]

      unless f.site and f.site.url and not f.site.url.blank?
        Resque.enqueue ReallyRemoveFact, fact_id
      end
    end
  end

  def self.down
  end
end

Use Fact.ids and don't use keep_if
Use Fact.ids and don't use keep_if
