我在升级到Rails 7.1时收到了一个弃用警告,谷歌没有搜索结果!
警告为DEPRECATION WARNING: Assigning a numeric/epoch value to scheduled_at is deprecated. Use a Time object instead.
这是在我们使用wait_until
调度后台作业时引发的。我们在测试中传递的值是1.month.from.now
,它给出了一个时间值。
我认为这一行提出了警告:
NotifyAudienceJob.set(wait_until: published_at).perform_later(audience.id)
以及触发警告的测试:
test 'creating audiences for a scheduled article with notifications enabled should schedule notifications' do
@article.update!(published_at: 1.month.from_now)
assert_enqueued_with(job: NotifyAudienceJob) do
post admin_news_feed_article_audiences_url(@article), params: { whole_organisation: true }
end
end
有没有人对解决这个问题有什么建议?
警告来自ActiveJob中的此行
注意:这在Rails 7.1.0.rc2中已修复
1条答案
按热度按时间kxe2p93d1#
将此对象转换为前面提到的
Time
对象现在它不是
Time
对象