class Game < Rentable
- has_many :game_genres, :through => Gamegenre
- has_many :gameplatforms, :through => Gameplatform
+ has_many :game_genres
+ has_many :game_platforms
- validates_presence_of :game_genre
- validates_presence_of :platform
+ 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
return Time.now.advance(:days => period).to_date
end
- def genre_name
- Gamegenre.find_by_id(game_genre).name
- end
-
- def platform_name
- Gameplatform.find_by_id(platform).name
- end
-
end