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?
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With