Reputation:
I'm looping over a collection of Movies in my movie like so:
<li>
<%= link_to image_tag(movie.image.url), movie %>
<%= link_to sanitize(movie.title), movie %>
</li>
But it's generating the following html:
<img alt="3382" src="http://0.0.0.0:3000/assets/http//s3-eu-west-1.amazonaws.com/ramen-hut/pictures/3382.jpg?1344477777">
It's baffled me, could anyone help on this? WHy is it adding that http://0.0.0.0:3000/assets/
url?
Upvotes: 3
Views: 729
Reputation: 7714
Because :
is missing after http
in your movie.image.url
.
Without http://
, Rails thinks this is an asset name and adds the asset prefix.
For example:
<%= image_tag 'http//foo/bar.jpg' %>
<%= image_tag 'http://foo/bar.jpg' %>
Outputs:
<img alt="Bar" src="/assets/http//foo/bar.jpg" />
<img alt="Bar" src="http://foo/bar.jpg" />
Upvotes: 3