'How does Rails resolve paths when running workers that are scheduled on an external Redis instance?

We are running Rails 6.1.4 (with Ruby 3.0.2) with Rescue 2.2.0 and Redis 4.5.1. Below is an example of a worker we have set up

class MyUserWorker < ActiveJob::Base
  queue_as :main_queue

  def perform(user_id)
    user = User.find(user_id)
    user.run_tasks
  end
end

Redis is configured to run on an external machine (not the same one as the app runs on). My question is how does Rails resolve the path to where worker code is run? We have both Ruby 3.0.2 and Ruby 2.4.5 installed on the box where Rails runs, but the worker generates this error when run

LoadError: cannot load such file -- active_support/current_attributes

However, I can see on the box where Rails runs that this file exists …

ls /usr/share/rvm/gems/ruby-3.0.2@my-app/gems/activesupport-7.0.2.2/lib/active_support/current_attributes.rb

What else should be checked to figure out how to tell Rails where the files it should use are?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source