tl-dr: Unable to generate non-fingerprinted image urls in non dev environments, is missing the host
I'm embedding images in my ActionMailer / Devise sent emails, like logos etc. This works when I use images in my assets folder, but are fingerprinted.
I don't want them to be fingerprinted / to use the fingerprinted assets that I use elsewhere in the application, so that these images don't break in future.
Putting images in the public folder works locally, but not on higher environments.
Asset folder working with fingerprinting:
<%= image_url('emails/header-Logo.png') %>
<%= asset_url('emails/header-Logo.png', :skip_pipeline => false) %>
# Generates fingerprint local + remote src=http://cdn.local.me:3000/assets/emails/header-Logo-57b82ca2de25bbafe57e4b21ed884d8c972344fca646ee08873fdbbfd9db8259.png
Public folder working (locally only), with no fingerprinting:
<%= asset_url('images/emails/Email-Welcome-Features.png', :skip_pipeline => true) %>
# Generates locally src="http://cdn.local.me:3000/images/emails/Email-Welcome-Features.png"
# Generates remote src="http:///images/emails/Email-Welcome-Features.png"
Prod config:
if ENV['CDN_HOSTNAME']
config.action_controller.asset_host = ENV['CDN_HOSTNAME']
config.action_mailer.asset_host = ENV['CDN_HOSTNAME']
end
Rails version: rails (6.0.2.2)