5 validates_presence_of :director
6 validates_presence_of :video_genre
7 validates_presence_of :media
10 return Videogenre.find(video_genre).name
14 return Media.find(media).name
18 # FIXME: generate this based on day of week, newrelease
19 day_of_week = Time.now.to_date.wday
20 base_fee = VideoPolicy.find_by_day(day_of_week).fee
22 # Check for newrelease
23 newrelease_fee = newrelease ? VideoPolicy.find_by_day(8).fee : 0.00
25 return base_fee + newrelease_fee
29 # FIXME: generate this based on the day of week, newrelease
30 # NOTE: a Date.wday will tell you the day of week (0-6, meaning Sunday-Saturday)
31 day_of_week = Time.now.to_date.wday
32 base_period = VideoPolicy.find_by_day(day_of_week).period
33 newrelease_period = newrelease ? VideoPolicy.find_by_day(8).period : 0
35 period = base_period + newrelease_period
36 return Time.now.advance(:days => period).to_date
41 errors.add(:video_genre, "does not exist in the database") if video_genre.nil?
42 errors.add(:media, "does not exist in the database") if media.nil?