Created
January 20, 2011 19:22
-
-
Save jrallison/788437 to your computer and use it in GitHub Desktop.
Easily mix dynamic content with fragment caching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @somethings.each do |something| %> | |
<%= cache("somethings:#{something.id}", :time => something.created_at) do %> | |
<div class="something"> | |
<%= render "somethings/expensive_calculation" %> | |
<!-- time.strftime(...) calculated dynamically every time --> | |
<p class="timestamp"><%= time.strftime("%B %d, %Y") %></p> | |
</div> | |
<% end %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment