Cache recent crops on homepage

This commit is contained in:
Skud committed 2013-08-14 12:38:52 +10:00
1 parent f0d4ec2690
commit ebe36438ba
2 files changed
+7 -4

No files matched your search

+2
View File
@@ -3,6 +3,7 @@ class CropSweeper < ActionController::Caching::Sweeper
def after_create(crop)
expire_fragment('homepage_stats')
expire_fragment('recent_crops')
end
def after_update(crop)
@@ -11,6 +12,7 @@ class CropSweeper < ActionController::Caching::Sweeper
def after_destroy(crop)
expire_fragment('homepage_stats')
expire_fragment('recent_crops')
end
end
+5 -4
View File
@@ -12,10 +12,11 @@
.row-fluid
.span12
%p
%strong
Recently added crops:
!= @recent_crops.map {|c| link_to(c, c) }.join(", ")
- cache "recent_crops" do
%p
%strong
Recently added crops:
!= @recent_crops.map {|c| link_to(c, c) }.join(", ")
%p
=link_to "View all crops", crops_path, :class => 'btn btn-primary'