Module: RactorRailsShim::InstallStrategy::Ractor

Defined in:
lib/ractor_rails_shim/roles/install_strategy.rb

Overview

Full install for Ractor (Puma/Falcon in Ractor mode, Falcon): all patches that route framework globals through per-Ractor IES.

Class Method Summary collapse

Class Method Details

.installObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ractor_rails_shim/roles/install_strategy.rb', line 21

def self.install
  RactorRailsShim.install_mattr_accessor
  RactorRailsShim.install_class_attribute
  RactorRailsShim.install_zeitwerk_registry
  RactorRailsShim.install_rubygems
  RactorRailsShim.install_rails_module
  RactorRailsShim::ConstantShareabilizer.install
  RactorRailsShim.install_execution_wrapper
  require "active_support/callbacks" rescue nil
  RactorRailsShim::CallbackCapture.install_callback_declaration_capture!
  # Patch ActionView::Base.with_empty_template_cache EARLY (before
  # eager load) so production's DetailsKey.view_context_class uses the
  # block-free version. The framework's original defines
  # compiled_method_container via define_method(&block) — an
  # un-shareable Proc that breaks worker Ractors. on_load fires as
  # soon as ActionView is required, well before the app's eager_load.
  ActiveSupport.on_load(:action_view) do
    RactorRailsShim._install_with_empty_template_cache_patch
  end
end