From c7790748349449d9e6eb2c2a43c93bd2faf1a70d Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 12:14:00 -0700 Subject: pass location json to partial. active records lazy instantiation of has_one relationship keeps returning nil. --- app/views/v1/licenses/_license.jbuilder | 2 +- app/views/v1/licenses/_location.jbuilder | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/v1/licenses/_license.jbuilder b/app/views/v1/licenses/_license.jbuilder index b62f91b..9d04606 100644 --- a/app/views/v1/licenses/_license.jbuilder +++ b/app/views/v1/licenses/_license.jbuilder @@ -1,6 +1,6 @@ json.id license.id json.status license.status.to_s -#json.partial! 'v1/licenses/location', location: license.location +json.partial! 'v1/licenses/location', location: license.to_json if license.confidential? json.partial! 'v1/licenses/confidential_well_type', well_type: license.well_type json.partial! 'v1/licenses/confidential_company' diff --git a/app/views/v1/licenses/_location.jbuilder b/app/views/v1/licenses/_location.jbuilder index 5b43756..b9c0625 100644 --- a/app/views/v1/licenses/_location.jbuilder +++ b/app/views/v1/licenses/_location.jbuilder @@ -1,5 +1,5 @@ json.location do - json.township location.township - json.latitude location.latitude - json.longitude location.longitude + json.township location["township"] + json.latitude location["latitude"] + json.longitude location["longitude"] end -- cgit v1.2.3