added plantings, seeds, and harvests to the crops JSON

This commit is contained in:
Skud
2014-06-12 19:44:09 -07:00
parent 039eb5472a
commit 2f8e060b49

View File

@@ -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