X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=app%2Fcontrollers%2Fvideo_controller.rb;h=ad3aaee348a757003ed76d781ea0c87d56e9ca2b;hb=2f9cf2b379b797bca623f032f7234f09e3b3c3af;hp=a5508aeb8f7e58facda15a98560449316714f7b5;hpb=0acc9549b65f2c3cd1840f39e31f2177a98bc55e;p=cs356-p2-videostore.git diff --git a/app/controllers/video_controller.rb b/app/controllers/video_controller.rb index a5508ae..ad3aaee 100644 --- a/app/controllers/video_controller.rb +++ b/app/controllers/video_controller.rb @@ -21,7 +21,12 @@ class VideoController < ApplicationController end def create + # A new rentable must be created and saved whenever we create a new + # video. This is so we have a rentable_id to add to the video. + @rentable = Rentable.new + @rentable.save! @video = Video.new(params[:video]) + @video.rentable_id = @rentable.id if @video.save flash[:notice] = 'Video was successfully created.' redirect_to :action => 'list'