X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=app%2Fmodels%2Fgame.rb;h=55639a7b7c27d5b457294d2b6e6312b7f4d395df;hb=d9ccb8cf52aee119343545cb734e185580daf352;hp=ed7f30bde2e1c8f3205b210bda70f416fff89962;hpb=f96a0f6949f29078cd2c5e3c81d3ac48ac710fbe;p=cs356-p2-videostore.git diff --git a/app/models/game.rb b/app/models/game.rb index ed7f30b..55639a7 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -1,13 +1,16 @@ class Game < Rentable - validates_presence_of :game_genre - validates_presence_of :platform + has_many :game_genres + has_many :game_platforms + + validates_presence_of :game_genre_id + validates_presence_of :game_platform_id def genre - return Gamegenre.find(game_genre).name + GameGenre.find_by_id(game_genre_id) end - def game_platform - return Gameplatform.find(platform).name + def platform + GamePlatform.find_by_id(game_platform_id) end def calculated_price