mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 13:38:24 -04:00
Reduces query numbes on gardens#show
This commit is contained in:
@@ -17,6 +17,7 @@ class GardensController < ApplicationController
|
||||
# GET /gardens/1
|
||||
# GET /gardens/1.json
|
||||
def show
|
||||
@plantings = @garden.plantings.includes(:crop, :garden, :owner, :harvests)
|
||||
respond_with(@garden)
|
||||
end
|
||||
|
||||
|
||||
@@ -65,18 +65,18 @@
|
||||
|
||||
.row-fluid
|
||||
%h3 What's planted here?
|
||||
- if @garden.plantings.current.empty?
|
||||
- if @plantings.current.empty?
|
||||
%p Nothing is currently planted here.
|
||||
- else
|
||||
- @garden.plantings.current.each.with_index do |planting_current, _|
|
||||
- @plantings.current.each.with_index do |planting_current, _|
|
||||
= render partial: "plantings/thumbnail", locals: { planting: planting_current }
|
||||
|
||||
.row-fluid
|
||||
%h3 Previously planted in this garden
|
||||
- if @garden.plantings.finished.empty?
|
||||
- if @plantings.finished.empty?
|
||||
%p Nothing has been planted here.
|
||||
- else
|
||||
- @garden.plantings.finished.each.with_index do |planting_finished|
|
||||
- @plantings.finished.each.with_index do |planting_finished|
|
||||
= render partial: "plantings/thumbnail", locals: { planting: planting_finished }
|
||||
.col-md-3
|
||||
%h4 About this garden
|
||||
|
||||
Reference in New Issue
Block a user