Lazy Load Content

Sometimes a portion of your page takes a really long time to generate and render. Instead of allowing the user to spin his thumbs, you can display the bulk of content to user and send off a separate ajax request to gather the “slow” data. Lazy Load Content makes late loading a portion of your page through ajax as easy as setting up a remote_function call. With options to render fragment cached if they exist, and perform the late load if not, your app will fly like the sloth eating eagle.
Install
ruby script/plugin install http://arperftoolkit.rubyforge.org/svn/trunk/lazy_load_content/
Copy the file javascripts/lazyLoadContent.js into your public/javascripts folder and include it with prototype.js in your views.
The Basics:
In your rhtml or haml file:
<h1> I love giraffes.. basically </h1>
<% lazy_load(:remote => {:update => 'lazyLoadContent', :url => {:action => 'lazy_load_action'}})do -%>
<div id = "lazyLoadContent"> We wait while the giraffes are smelling themselves. </div>
<% end -%>
In your controller define the specified function
def lazy_load_action render :text => 'The giraffes are ready!' end
When the page loads, the loading text is displayed: We wait while the giraffes are smelling themselves.
Then after the ajax call we see: The giraffes are ready!
…….. and more………. Read the rest of this entry »
Posted by blythedunham
Im all pissy today because Rails is spewing all these sql statements out and I have no idea where they are coming from so I can add my little optimizations or what have you. As if I wasn’t already 
into your ear, but believe me, it will steal your memory, your lover and your freetime. If you are using apache or lighttpd, all the cool kids are using the x_send_file plugin. Nginx fans, check out my monkey patch so you too can send files, flowers and love without crashing mongrels with nginx’s equivalent