mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-26 08:48:28 -04:00
Cache recent crops on homepage
This commit is contained in:
1 parent
f0d4ec2690
commit
ebe36438ba
2 files changed
+7
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in new issue
Block a user