update models
This commit is contained in:
parent
339a262e06
commit
e63409d72a
@ -17,6 +17,9 @@ class CampaignsController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
if @campaign.processed
|
||||
redirect_to campaign_path(@campaign.listingcode), notice: 'Campaign has been submitted, Cannot edit.'
|
||||
end
|
||||
@action = campaign_path(@campaign.listingcode)
|
||||
end
|
||||
|
||||
@ -65,13 +68,13 @@ class CampaignsController < ApplicationController
|
||||
|
||||
def campaign_params
|
||||
params.require(:campaign).permit(:id, :address, :advertisername, :awards, :background, :billingcode,
|
||||
:businessphone, :categories, :city, :clientid, :companycolors, :contactphone,
|
||||
:businessphone, :categories, :city, :companycolors, :contactphone,
|
||||
:customerfirstname, :customerlastname, :description, :emailaddress, :facebookurl,
|
||||
:listingcode, :productsandservices, :state, :targetaudience, :tollfreephone,
|
||||
:vpa, :websiteurl, :zip,
|
||||
|
||||
videolistings_attributes: [:_destroy, :id, :asseturls, :clientprovidedscript, :focus,
|
||||
:keywords, :musicselection, :notes, :producttypeid,
|
||||
:keywords, :musicselection, :notes,
|
||||
:videocode, :voiceoverselection,
|
||||
])
|
||||
end
|
||||
|
@ -1,8 +1,6 @@
|
||||
class Campaign < ActiveRecord::Base
|
||||
has_many :videolistings, :dependent => :delete_all
|
||||
accepts_nested_attributes_for :videolistings,:reject_if => :all_blank, :allow_destroy => true
|
||||
validates :clientid, presence: true, uniqueness: true
|
||||
validates :billingcode, uniqueness: true
|
||||
validates :listingcode, presence: true, uniqueness: true
|
||||
validates :advertisername, presence: true
|
||||
validates :websiteurl, presence: true
|
||||
@ -14,8 +12,6 @@ class Campaign < ActiveRecord::Base
|
||||
self.clientid = 720
|
||||
end
|
||||
|
||||
|
||||
|
||||
after_create :send_to_better_video
|
||||
def send_to_better_video
|
||||
#TODO Make API Calls
|
||||
|
@ -9,6 +9,7 @@ Vidpush::Application.routes.draw do
|
||||
|
||||
root to: "campaigns#index"
|
||||
|
||||
resources :campaigns, param: :listingcode
|
||||
resources :campaigns, param: :listingcode do
|
||||
resources :videolistings, param: :videocode
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user