Rails 3.1 now requires use image_tagwhen rendering an image using the asset pipeline.
I created an infinite scroll in my application and put the code in the js.coffee file. I want to make a rotating boot gif while loading more products. I cannot use it image_taghere, because this file does not support rails code, but I wrote it here so that you understand what I'm trying to do.
jQuery ->
if $('.pagination').length
$(window).scroll ->
url = $('.pagination .next_page').attr('href')
if url && $(window).scrollTop() > $(document).height() - $(window).height() - 1200
$('.pagination').html("<%= image_tag("loading.gif") %> Loading more...")
$.getScript(url)
$(window).scroll()
I used to just write it in pure HTML using <img src=...But this will no longer work with the asset pipeline. How can I achieve this?
tob88 source
share