2013-07-20 49 views
0

on Rails的Premailer圖像參考我使用premailer,和我的本地機器上我會在郵箱音符像這樣的鏈接:本地機器

file://localhost/assets/header_logo.png 

代替

http://localhost:3000/assets/header_logo.png 

如何配置premailer,以便在開發過程中url是正確的?

我嘗試添加

Premailer::Rails.config.merge!(base_url: "http://localhost:3000") 

我開發的配置文件,但是服務器barfs說有沒有一種方法Premailer :: Rails.config。

我也這樣做:

config.action_mailer.default_url_options = {:host => 'localhost:3000'} 

無濟於事......

回答

1

所以,問題是,我還是用了premailer-Rails3中的寶石,但讀premailer護欄文檔。只需更新premailer-rails的gem即可解決問題。

0

對於檔案......你也可以把這個說成配置/初始化/ premailer.rb,它會拿起任何你已經爲的ActionMailer設置...

Premailer::Rails.config.merge!(
    :base_url => "http://#{ActionMailer::Base.default_url_options[:host]}" 
)