my rails view looks like this (it is a partial):
=javascript_include_tag :defaults
#scroller
-@other_images.each do |img|
.thumbnail_wrapper
.thumbnail_image
=image_tag img.image.url(:thumbnail), :class => 'button', :onClick => "replaceImg(#{img.id});", :onLoad => "setLastID(#{ @other_images[0].id });"
I want to call the function setLastID(#{ @other_images[0].id }); only once, when the whole view loads. However, I couldn't figure out how... this was the only place I could put it where it worked. But now it's been called each time within the loop... Help!!