Cache whole previews list fragments

openid
Marcin Kulik 12 years ago
parent a13ae3ba2c
commit 44edbe08d1

@ -23,6 +23,11 @@ class Asciicast < ActiveRecord::Base
update_all(:user_id => user.id, :user_token => nil)
end
def self.cache_key
timestamps = scoped.select(:updated_at).map { |o| o.updated_at.to_i }
Digest::MD5.hexdigest timestamps.join('/')
end
def meta=(file)
data = JSON.parse(file.tempfile.read)

@ -1,3 +1,5 @@
<div class="presentations">
<%= render :partial => 'asciicasts/preview', :collection => @asciicasts %>
<% cache @asciicasts do -%>
<%= render :partial => 'asciicasts/preview', :collection => @asciicasts %>
<% end -%>
</div>

Loading…
Cancel
Save