我希望能够使用以下方法像这样使用它:clear_tire_index_for Answer, Question
def clear_tire_index_for(resource)
resource.index.delete
resource.tire.create_elasticsearch_index
resource.index.refresh
end
怎么做?
答案 0 :(得分: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