Ruby
Article

How to Increase Performance in Rails: the stale? method

By Fernando Tinoco

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.

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

  • http://doelsengupta.blogspot.in doel

    Thanks for posting this, never knew stale? is so useful :)

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Ruby, once a week, for free.