From 2129b6480d34c9e43fa3d87ba96836fd78bb4cc4 Mon Sep 17 00:00:00 2001 From: Mackenzie Morgan Date: Mon, 28 Nov 2016 22:42:11 -0500 Subject: [PATCH] ...that was a guard clause. oops --- app/models/crop.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/crop.rb b/app/models/crop.rb index 008d7f826..67694b8d0 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -137,7 +137,7 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength # later we can choose a default photo based on different criteria, # eg. popularity def default_photo - photos.first if photos.any? + return photos.first if photos.any? # Crop has no photos? Look for the most recent harvest with a photo. harvest_with_photo = Harvest.where(crop_id: id).joins(:photos).order('harvests.id DESC').limit(1).first