Search code examples
ruby-on-railspremailer

Rails Premailer image reference on local machine


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...


Solution

  • 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.