문제

I have a mailer template in rails. I am trying to use the url of a paperclip attachment: <%=item.picture.url%>

OFcourse, this only renders the path which is pretty useless in an email. I need to get the absolute url.

Also since I am using rake to run the task, there is no request per se. I remember setting the default host in
config.action_mailer.default_url_options = { :host => 'sitename.com' }

How do I access this value in the mailer template?

도움이 되었습니까?

해결책

you can use helper in action-mailer and absolute url helper is root_url.

다른 팁

Try this

You can get the host name using the below line of code

request.host

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top