From ea35816654404128e825bc40c5fc2764b39cd156 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 27 Jan 2019 18:12:37 +1300 Subject: [PATCH] Fix ordering of recent harvests --- app/views/crops/_harvests.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/crops/_harvests.html.haml b/app/views/crops/_harvests.html.haml index 4a70bb251..5f5c2bc78 100644 --- a/app/views/crops/_harvests.html.haml +++ b/app/views/crops/_harvests.html.haml @@ -4,12 +4,12 @@ Nobody has harvested this crop yet. - else %ul - - crop.harvests.take(3).each do |harvest| + - crop.harvests.order(harvested_at: :desc).limit(3).each do |harvest| %li = link_to "#{harvest.owner} harvested #{display_quantity(harvest)}.", harvest_path(harvest) - = render partial: 'members/location', locals: { member: harvest.owner } + = render 'members/location', member: harvest.owner %small - = distance_of_time_in_words(harvest.created_at, Time.zone.now) + = distance_of_time_in_words(harvest.harvested_at, Time.zone.now) ago. %p = link_to "View all #{crop.name} harvests", harvests_by_crop_path(crop)