From 6b059cb4f42083fcfbebf62a346227c0bffe3b28 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Fri, 8 Jul 2016 17:06:05 +0930 Subject: [PATCH] Clean up a bit as per #1013 with TODO comments --- app/controllers/crops_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index 3d908643f..9dd8a3ed4 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -83,8 +83,16 @@ class CropsController < ApplicationController respond_to do |format| format.html # show.html.haml format.json do + # TODO RABL or similar one day to avoid presentation logic here + owner_structure = { + owner: { + only: [:id, :login_name, :location, :latitude, :longitude] + } + } render json: @crop.to_json(include: { - plantings: { include: { owner: { only: [:id, :login_name, :location, :latitude, :longitude] }}} + plantings: { + include: owner_structure + } }) end end