json with nested assets

This commit is contained in:
Tyrel Souza 2014-04-18 15:34:44 -04:00
parent 0fe6a71380
commit 067c5b9c3c
3 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,7 @@ class CampaignsController < ApplicationController
def show
respond_to do |format|
format.json { render json: @campaign }
format.json { render json: @campaign, include: [:videolistings,] }
format.html { render html: @campaign }
end
end

View File

@ -12,4 +12,5 @@ class Campaign < ActiveRecord::Base
#TODO Make API Calls
end
end

View File

@ -4,6 +4,6 @@ class Videolisting < ActiveRecord::Base
validates :producttypeid, presence: true
def asseturls_array
self.asseturls.split(',').collect(&:strip)
self.asseturls.split(',').collect { |url| { asseturl: url.strip } }
end
end