Campaigns now accept nested VideoListings when you create one via a json post.
This commit is contained in:
parent
8b747da6dc
commit
dd0c0e4ab0
@ -13,7 +13,7 @@ class CampaignsController < ApplicationController
|
|||||||
# GET /campaigns/new
|
# GET /campaigns/new
|
||||||
def new
|
def new
|
||||||
@campaign = Campaign.new
|
@campaign = Campaign.new
|
||||||
@campaign.videolistings.build
|
@campaign.videolistings
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /campaigns/1/edit
|
# GET /campaigns/1/edit
|
||||||
@ -23,8 +23,7 @@ class CampaignsController < ApplicationController
|
|||||||
# POST /campaigns
|
# POST /campaigns
|
||||||
def create
|
def create
|
||||||
@campaign = Campaign.new(campaign_params)
|
@campaign = Campaign.new(campaign_params)
|
||||||
@campaign.videolistings.build
|
|
||||||
binding.pry
|
|
||||||
if @campaign.save
|
if @campaign.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render json: @campaign }
|
format.json { render json: @campaign }
|
||||||
@ -62,14 +61,8 @@ class CampaignsController < ApplicationController
|
|||||||
:address2, :city, :state, :zip, :emailaddress, :customerfirstname,
|
:address2, :city, :state, :zip, :emailaddress, :customerfirstname,
|
||||||
:customerlastname, :salesrep, :salesrepemail, :businessphone,
|
:customerlastname, :salesrep, :salesrepemail, :businessphone,
|
||||||
:contactphone, :websiteurl,
|
:contactphone, :websiteurl,
|
||||||
videolistings: [:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
|
videolistings_attributes: [:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
|
||||||
:musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls,])
|
:musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls,])
|
||||||
end
|
end
|
||||||
|
|
||||||
def videolisting_params
|
|
||||||
params.require(:videolistings).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection,
|
|
||||||
:musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user