require_dependency 'lazy_load_content' # The filters added to this controller will be run for all controllers in the application. # Likewise will all the methods added be available for all controllers. class LazyLoadTestController < SpongecellController def index; redirect_to :action => :lazy_load_test; end def lazy_load_action render :partial => 'lazy_load_content' end def lazy_load_test render :action => 'lazy_load_test' end # Parameters: {"action"=>"lazy_load_bulk_action", "controller"=>"lazy_load_test", # "lazy_load"=>[{"id"=>"1", "update"=>"lazyLoadContentOne"}, {"id"=>"2", "update"=>"lazyLoadContentTwo"}]} def lazy_load_bulk_action logger.debug params.inspect render(:update) do |page| params[:lazy_load].each do |item| # Query on item[:id] or go nuts if you like # # Pass the item[:id] into the partial page.replace_html item[:update], :partial => 'lazy_load_content_bulk', :locals => {:passed_id => item[:id]} end end end end