When I send links in an email from a Ruby on Rails application, I use the link_to
function:
<%= link_to @user.name, controller: 'users', action: 'show', id: @user.id, only_path: false %>
This will produce a link like this:
http://www.example.com/users/58
Or if I'm on my development environment:
http://localhost:3000/users/58
How do I do the same with images? I've tried:
<%= image_tag "/invitations/#{@invitation.id}/open.png", only_path: false %>
I was hoping to see:
<img alt="Open" src="http://www.example.com/invitations/43/open.png" />
But I got this instead unfortunately:
<img alt="Open" only_path="false" src="/invitations/43/open.png" />
How do I get img
tags to use the full URL based on the host I specified in my environment files?