I fixed it using what I had thought about doing. And that is prepending the CDN url during prod and staging env.
def default_url
if !(Rails.env.development? || Rails.env.test?)
"#{Settings.asset_host}#{ActionController::Base.helpers.asset_path("panOpen_v2/" + [version_name, "panopen_beta_logo_flat_white_med.png"].compact.join('_'))}"
else
ActionController::Base.helpers.asset_path("panOpen_v2/" + [version_name, "panopen_beta_logo_flat_white_med.png"].compact.join('_'))
end
end
The Settings.asset_host
is the url to my CDN.
It's not a perfect solution. And I'd rather not have to do that. So if anyone has a better idea, I'd love to hear it.