So the problem was that I was still using the premailer-rails3 gem, but reading the premailer-rails doc. Just updating the gem to premailer-rails fixed the issue.
Rails Premailer image reference on local machine
-
03-06-2022 - |
سؤال
I am using premailer, and on my local machine I get links like this in the mail notes:
file://localhost/assets/header_logo.png
instead of
http://localhost:3000/assets/header_logo.png
How do I configure premailer so that the url is correct while in development?
I tried adding
Premailer::Rails.config.merge!(base_url: "http://localhost:3000")
to my development config file, but the server barfs saying there is no method Premailer::Rails.config.
I also did this:
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
to no avail...
المحلول
نصائح أخرى
For the archives... you can also put this into say config/initializers/premailer.rb and it will pick up whatever you've set for ActionMailer...
Premailer::Rails.config.merge!(
:base_url => "http://#{ActionMailer::Base.default_url_options[:host]}"
)
لا تنتمي إلى StackOverflow