Merge branch 'dev' into planting-reminders

This commit is contained in:
Brenda Wallace
2019-10-20 21:36:42 +13:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -17,10 +17,11 @@ class GardensController < ApplicationController
end
def show
@current_plantings = @garden.plantings.current
.includes(:crop, :owner)
.order(planted_at: :desc)
@current_plantings = @garden.plantings.current.includes(:crop, :owner).order(planted_at: :desc)
@finished_plantings = @garden.plantings.finished.includes(:crop)
@suggested_companions = Crop.approved.where(
id: CropCompanion.where(crop_a_id: @current_plantings.select(:crop_id)).select(:crop_b_id)
).order(:name)
respond_with(@garden)
end

View File

@@ -59,9 +59,8 @@
%section.companions
%h2 Suggestioned companions
- @garden.plantings.each do |planting|
- planting.crop.companions.approved.each do |companion|
= render 'crops/tiny', crop: companion
- @suggested_companions.each do |companion|
= render 'crops/tiny', crop: companion
%section= render 'previously'