Make system unable to check out already checked out items
[cs356-p2-videostore.git] / app / models / video.rb
1 class Video < Rentable
2   has_many :video_genres
3   has_many :medias
4
5   validates_presence_of :director
6   validates_presence_of :video_genre
7   validates_presence_of :media
8
9   def calculated_price
10     # FIXME: generate this based on day of week, newrelase
11     return 11
12   end
13
14   def due_date
15     # FIXME: generate this based on the day of week, newrelease
16     return Time.now.advance(:days => 2).to_date
17   end
18
19   protected
20   def validate
21     errors.add(:video_genre, "does not exist in the database") if video_genre.nil?
22     errors.add(:media, "does not exist in the database") if media.nil?
23   end
24 end