大家好,我是 Wojtek。让我们一起来看看本周的 Rails 新闻。
最后的 RailsConf
最后一届 RailsConf(7 月 8 日至 10 日,费城)将包括与 DHH 的炉边谈话,以及与 Rails 团队成员 Eileen Uchitelle(核心)、Gannon McGibbon(提交者)、Hartley McGuire(问题)和 Matheus Richard(分类)的演讲或小组讨论,还有许多新面孔和熟悉的面孔。 门票仍在发售中。
引入 Active Job Continuations
允许中断和恢复作业,并使用 Continuations。
作业可以通过包含 `ActiveJob::Continuable` concern 来使用 Continuations。Continuations 将作业拆分为多个步骤。当排队系统关闭时,作业可以被中断并保存其进度。
class ProcessImportJob
include ActiveJob::Continuable
def perform(import_id)
@import = Import.find(import_id)
# block format
step :initialize do
@import.initialize
end
# step with cursor, the cursor is saved when the job is interrupted
step :process do |step|
@import.records.find_each(start: step.cursor) do |record|
record.process
step.advance! from: record.id
end
end
# method format
step :finalize
private
def finalize
@import.finalize
end
end
end
从 GitHub Actions 模板中移除不必要的 ruby-version 输入
默认情况下,`.ruby-version` 文件会由 `ruby/setup-ruby` action 首先尝试。
缓存成功的反射缓存验证
关联反射是存储有关关联元数据的对象。一旦定义了关联,它就全部设置好了,关联无法被修改,反射也不应被修改。这提供了性能改进。
rails-dom-testing v2.3.0 发布
它带来了一个方便的新断言 assert_not_dom,可以在应用集成测试中使用。
您可以在 此处 查看完整的更改列表。 上周,有 10 位贡献者 为 Rails 代码库做出了贡献!
下次再见!
订阅以通过邮件获取这些更新。