don't pass photos to crops/_photos

This commit is contained in:
Brenda Wallace
2020-01-02 20:29:41 +13:00
parent fb0d57c98f
commit f27ac12563
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
- if photos.size.positive?
- if crop.photo_associations_count.positive?
%h2 #{photo_icon} Photos
- [Crop, Planting, Harvest, Seed].each do |model_name|
- if photos.by_model(model_name).size.positive?
- if crop.photos.by_model(model_name).size.positive?
%h3 #{@crop.name.capitalize} #{t("activerecord.models.#{model_name.to_s.downcase}.other")}
= render 'photos/gallery', photos: photos.by_model(model_name).includes(:owner).order(likes_count: :desc).limit(5)
= render 'photos/gallery', photos: crop.photos.by_model(model_name).includes(:owner).order(likes_count: :desc).limit(5)
= link_to 'more photos »', crop_photos_path(@crop), class: 'btn'

View File

@@ -32,7 +32,7 @@
%section.photos
= cute_icon
= render 'crops/photos', photos: @photos, crop: @crop
= render 'crops/photos', crop: @crop
- if @crop.plantings.any?
%section.charts