From 2f8e060b49a6bdbfcdce1d738e47d3459bdc8d21 Mon Sep 17 00:00:00 2001 From: Skud Date: Thu, 12 Jun 2014 19:44:09 -0700 Subject: [PATCH] added plantings, seeds, and harvests to the crops JSON --- app/controllers/crops_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index 94941c9ff..6fc04de7e 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -10,7 +10,7 @@ class CropsController < ApplicationController @crops = Crop.includes(:scientific_names, {:plantings => :photos}).paginate(:page => params[:page]) respond_to do |format| - format.html + format.html format.json { render :json => @crops } format.rss do @crops = Crop.recent.includes(:scientific_names, :creator) @@ -62,7 +62,9 @@ class CropsController < ApplicationController respond_to do |format| format.html # show.html.haml - format.json { render json: @crop } + format.json do + render :json => @crop.to_json(:include => [:plantings, :seeds, :harvests]) + end end end