I've made an array in my controller with the items that I would like to rotate through. The initial set is used as a partial collection and looped through.
render :partial => "partial", :collection => @array[1..4]
I also have a link_to_remote link on the page that makes a POST request to the controller to change the range on the collection.
link_to_remote "Next", :url => {:action => "update"}, :update => "partial_div"
I would like to have an incremental counter that is returned and then subsequently posted again to move forward. Like this:
respond_to do |format|
format.js{
@counter += 4
render :partial => "partial", :collection => @array[@counter..(@counter + 4)]
}
Thanks!