diff --git a/app/models/planting.rb b/app/models/planting.rb index 8d41e9bd2..a33b82b31 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -114,6 +114,7 @@ class Planting < ActiveRecord::Base end def update_harvest_days + return unless harvests.size.positive? # how long ago was this planted first_harvest = (harvests.first.harvested_at - planted_at).to_i last_harvest = finished? ? (harvests.last.harvested_at - planted_at).to_i : nil