projects
/
cs356-p2-videostore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add VideoGenres to the system
[cs356-p2-videostore.git]
/
app
/
models
/
game.rb
diff --git
a/app/models/game.rb
b/app/models/game.rb
index
f2e627c
..
55639a7
100644
(file)
--- a/
app/models/game.rb
+++ b/
app/models/game.rb
@@
-1,16
+1,16
@@
class Game < Rentable
class Game < Rentable
- has_many :game_genres
, :through => Gamegenre
- has_many :game
platforms, :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
def genre
- return Gamegenre.find(game_genre).name
+ GameGenre.find_by_id(game_genre_id)
end
end
- def
game_
platform
- return Gameplatform.find(platform).name
+ def platform
+ GamePlatform.find_by_id(game_platform_id)
end
def calculated_price
end
def calculated_price
@@
-35,12
+35,4
@@
class Game < Rentable
return Time.now.advance(:days => period).to_date
end
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
end