This Week in Rails

May 30, 2025

Active Job Continuations and more

Hi, Wojtek here. Let’s see this week’s news about Rails.

Final RailsConf
The last RailsConf (July 8 - 10, Philadelphia) will include a fireside chat with DHH, and talks or panel discussions with Rails team members Eileen Uchitelle (Core), Gannon McGibbon (Committers), Hartley McGuire (Issues), and Matheus Richard (Triage), as well as many more new and familiar faces. Tickets are still available.

Introduce Active Job Continuations
Allow jobs to the interrupted and resumed with Continuations.

A job can use Continuations by including the ActiveJob::Continuable concern. Continuations split jobs into steps. When the queuing system is shutting down jobs can be interrupted and their progress saved.

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

Remove unnecessary ruby-version input from GitHub Actions template

.ruby-version file is tried first by default by the ruby/setup-ruby action.

Memoize successful reflection cache validation
Association reflections are objects that store metadata about an association. Once an association has been defined, it is all set, the association cannot be mutated, and the reflection should not be mutated either. This provides a performance improvement.

rails-dom-testing v2.3.0 released
It brings a handy new assertion assert_not_dom that can be used in app integration tests.

You can view the whole list of changes here. We had 10 contributors to the Rails codebase this past week!

Until next time!

About This Week in Rails

Your weekly inside scoop of interesting commits, pull requests and more from Rails.