我正在写一个 rake 任务。问题是我想在if keeper.has_trevance_info? && candidate.has_trevance_info?
为真时停止执行任务。我只想让它打印Another record already has that info!
在日志中并停止任务。我该怎么做?会是raise
还是throw
?
billing_infos.each do |candidate|
unless keeper.nil?
raise "Another record already has that info! Manually compare BillingInfo ##{keeper.id}
and ##{candidate.id}" if keeper.has_trevance_info? && candidate.has_trevance_info?
else
keeper = candidate
end
end