Here's a quick grab from an 1.0 app I've got. Downside with this is that
you need to manually expired the cache if the post updates. Personally, I
like adding the update time and storing the cache in memcache. Then you
don't have to worry about expiring old items. btw, this is just standard
rails fragment caching but by defining it in a tag, you can easily use it
all over your website.
<def tag="card" for="Post">
<% cache(:controller => :posts, :action => :card, :id => this.id, :tz =>
Time.zone) do %>
<h2 param="title"><a><view:title /></a></h2>
<p param="timestamp">Posted <view:created_at /> by <view:user /></p>
<p param="body"><view:body /></p>
<float-clear />
<% end %>
<p param="count"><a param="count-link"><my-count:comments /></a></p>
</def>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.