Campaigns now accept nested VideoListings when you create one via a json post.

This commit is contained in:
Tyrel Souza 2014-04-08 16:02:51 -04:00
parent 8b747da6dc
commit dd0c0e4ab0

View File

@ -13,7 +13,7 @@ class CampaignsController < ApplicationController
# GET /campaigns/new
def new
@campaign = Campaign.new
@campaign.videolistings.build
@campaign.videolistings
end
# GET /campaigns/1/edit
@ -23,8 +23,7 @@ class CampaignsController < ApplicationController
# POST /campaigns
def create
@campaign = Campaign.new(campaign_params)
@campaign.videolistings.build
binding.pry
if @campaign.save
respond_to do |format|
format.json { render json: @campaign }
@ -62,14 +61,8 @@ class CampaignsController < ApplicationController
:address2, :city, :state, :zip, :emailaddress, :customerfirstname,
:customerlastname, :salesrep, :salesrepemail, :businessphone,
:contactphone, :websiteurl,
videolistings: [:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
videolistings_attributes: [:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
:musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls,])
end
def videolisting_params
params.require(:videolistings).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
:musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
end
end