Brainstorming approaches to reconcile Rails 8's default multi-DB setup with DATABASE_URL

I’m using Fly and found this discussion. This proposed hacky solution worked for me except my github CI test run was failing with:

URI::InvalidComponentError: bad component(expected absolute path component): _cache (URI::InvalidComponentError)

I solved it by adding a production? check to the end of that line:

url: <%= URI.parse(ENV['DATABASE_URL']).tap { |u| u.path += '_cache' } if ENV['DATABASE_URL'] && Rails.env.production? %>
2 Likes