X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=app%2Fcontrollers%2Fvideo_controller.rb;h=31575d86e6566b54b0b3953b1c69945417131dde;hb=9b264f25255cc0e7cca3169d99905f590c8be578;hp=529e695662c689ccb236109d3e8cfa5e9feb261f;hpb=620ca6eedb2bc3b9c31da71553c081f3442b95ce;p=cs356-p2-videostore.git diff --git a/app/controllers/video_controller.rb b/app/controllers/video_controller.rb index 529e695..31575d8 100644 --- a/app/controllers/video_controller.rb +++ b/app/controllers/video_controller.rb @@ -21,11 +21,7 @@ class VideoController < ApplicationController end def create - @rentable = Rentable.new - @rentable.save! - puts "created new rentable with ID: #{@rentable.id}" @video = Video.new(params[:video]) - @video.rentable_id = @rentable.id if @video.save flash[:notice] = 'Video was successfully created.' redirect_to :action => 'list' @@ -52,4 +48,13 @@ class VideoController < ApplicationController Video.find(params[:id]).destroy redirect_to :action => 'list' end + + def searchbyname + render :action => 'searchbyname' + end + + def searchresults + query = params[:q] + @videos = Video.find(:all, :conditions => ["title like ?", query[0]+"%"]) + end end