How to Increase Performance in Rails: the stale? method
On his last appearance on Talk With the Experts, SitePoint’s developer Mal Curtis was asked about performance issues on Ruby on Rails apps and ways to increase speed. One of his suggestion was to use the stale? method, a sometimes underused function in Rails that can, out of the box, do a very good job of automatically reducing perceived latency.
In a nutshell, the stale? method prevents rendering of an entire template when there is no need to. Rails and the browser handle everything correctly for you as a status 304 (not modified) is returned instead a normal status 200.
Mal has put the video below together to show, in 3 minutes, how to use the stale? method on its most basic form to increase speed on a Ruby on Rails app. Great tip.