Memcache caching of harvests

This commit is contained in:
Brenda Wallace
2019-12-09 20:06:48 +13:00
parent 49941d3c1b
commit bfe1b072db
4 changed files with 25 additions and 24 deletions

View File

@@ -1,11 +1,12 @@
.card
= link_to harvest do
= image_tag harvest_image_path(harvest), alt: harvest, class: 'img-card'
.card-body
%h5
= crop_icon(harvest.crop)
%strong
= link_to harvest.crop, harvest
%span.badge.badge-pill= harvest.plant_part
.card-footer
.float-right=render 'members/tiny', member: harvest.owner
- cache harvest do
.card
= link_to harvest do
= image_tag harvest_image_path(harvest), alt: harvest, class: 'img-card'
.card-body
%h5
= crop_icon(harvest.crop)
%strong
= link_to harvest.crop, harvest
%span.badge.badge-pill= harvest.plant_part
.card-footer
.float-right=render 'members/tiny', member: harvest.owner

View File

@@ -1,6 +1,4 @@
- if local_assigns[:full]
- cache harvest do
= render 'harvests/card', harvest: harvest
= render 'harvests/card', harvest: harvest
- else
- cache harvest do
= render 'harvests/thumbnail', harvest: harvest
= render 'harvests/thumbnail', harvest: harvest

View File

@@ -1,9 +1,10 @@
.card.harvest-thumbnail
= link_to image_tag(harvest_image_path(harvest),
alt: harvest,
class: 'img img-card'),
harvest
- cache harvest do
.card.harvest-thumbnail
= link_to image_tag(harvest_image_path(harvest),
alt: harvest,
class: 'img img-card'),
harvest
.text
%h3.harvest-plant-part= link_to harvest.plant_part, harvest
%h5.harvest-crop= harvest.crop
.text
%h3.harvest-plant-part= link_to harvest.plant_part, harvest
%h5.harvest-crop= harvest.crop

View File

@@ -32,5 +32,6 @@
%h2
= page_entries_info @harvests
= will_paginate @harvests
.index-cards=render @harvests, full: true
.index-cards
= render @harvests, full: true
= will_paginate @harvests