【发布时间】:2013-07-23 02:58:10
【问题描述】:
我正在编写一个 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
【问题讨论】:
标签: ruby-on-rails ruby rake raise