2

我希望能够使用下面的方法来使用它:clear_tire_index_for Answer, Question

  def clear_tire_index_for(resource)
    resource.index.delete
    resource.tire.create_elasticsearch_index
    resource.index.refresh
  end

怎么做?

4

1 回答 1

3
def clear_tire_index_for(*resources)
    resources.each do |res|
        res.index.delete
        res.tire.create_elasticsearch_index
        res.index.refresh
    end
end

clear_tire_index_for Answer, Question
clear_tire_index_for Answer
于 2012-12-28T13:24:43.040 回答