Tom Rossi
Tom Rossi

Reputation: 12066

How do you populate the host for image_url helper in a mailer?

I have the asset host specified in my Rails 5.2.0 config:

config.action_controller.asset_host = "assets.example.com"

But the image_url helper still only returns the path without the host. I am using <%= image_url('/something') %> in my mailer view file. Whenever it renders it just uses the path "/images/something".

Upvotes: 0

Views: 567

Answers (1)

Mark
Mark

Reputation: 6445

The config.action_controller.asset_host setting will only affect the asset host in your views. To set it in your mailer, try:

config.action_mailer.asset_host = "http://stage.example.com"

Upvotes: 1

Related Questions