Skip to content

Instantly share code, notes, and snippets.

View pauldanielm's full-sized avatar

Paul Mayzeles pauldanielm

View GitHub Profile
@pauldanielm
pauldanielm / application.rb
Created September 2, 2025 17:55
Railties patches for making Rails compatible with bazel symlink-based sandboxes.
# add this patch to application.rb after `require 'rails/all'`
# see https://github.com/rails/rails/issues/55578 for more details
if ENV['BAZEL_TEST']
# This patch is necessary so that Rails.root is resolved within the symlink sandbox.
# We avoid use of caller_locations absolute_path since it is not the absolute path
# but rather the realpath, which escapes the symlink sandbox and causes errors during
# test run time.
# We make a similar change in find_root_with_flag to avoid the use of `realpath` for
# the same reason.