X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=app%2Fcontrollers%2Fgame_controller.rb;h=42a037e0a5a1feb6773c6114cf2145d4b6a10f7d;hb=9b264f25255cc0e7cca3169d99905f590c8be578;hp=50f6a95bc37a5d5f44f8f30e7eab17697534d5c5;hpb=7f26973835fc8deef03d25d751e92e4c633ae464;p=cs356-p2-videostore.git diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index 50f6a95..42a037e 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -21,11 +21,7 @@ class GameController < ApplicationController end def create - # A new rentable must be created whenever we create a new game - @rentable = Rentable.new - @rentable.save @game = Game.new(params[:game]) - @game.rentable_id = @rentable.id if @game.save flash[:notice] = 'Game was successfully created.' redirect_to :action => 'list' @@ -52,4 +48,13 @@ class GameController < ApplicationController Game.find(params[:id]).destroy redirect_to :action => 'list' end + + def searchbyname + render :action => 'searchbyname' + end + + def searchresults + query = params[:q] + @games = Game.find(:all, :conditions => ["title like ?", query[0]+"%"]) + end end