We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bab4114 + 6c1bbe9 commit 6118350Copy full SHA for 6118350
app/helpers/photos_helper.rb
@@ -17,17 +17,17 @@ def garden_image_path(garden)
17
18
def planting_image_path(planting)
19
if planting.photos.present?
20
- planting.photos.first.thumbnail_url
+ planting.photos.order(date_taken: :desc).first.thumbnail_url
21
else
22
placeholder_image
23
end
24
25
26
def harvest_image_path(harvest)
27
if harvest.photos.present?
28
- harvest.photos.first.thumbnail_url
29
- elsif harvest.planting.present? && harvest.planting.photos.present?
30
- harvest.planting.photos.first.thumbnail_url
+ harvest.photos.order(date_taken: :desc).first.thumbnail_url
+ elsif harvest.planting.present?
+ planting_image_path(harvest.planting)
31
32
33
0 commit comments