X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=app%2Fmodels%2Fgame.rb;h=55639a7b7c27d5b457294d2b6e6312b7f4d395df;hb=d9ccb8cf52aee119343545cb734e185580daf352;hp=15bf8e0ea3c47e50d74990aed7d80cd4584a3ed6;hpb=2818e8becfb6a257df623713d507f0994d5cc278;p=cs356-p2-videostore.git diff --git a/app/models/game.rb b/app/models/game.rb index 15bf8e0..55639a7 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -1,9 +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 platform + GamePlatform.find_by_id(game_platform_id) end def calculated_price