From: Ira W. Snyder Date: Thu, 22 Nov 2007 06:36:22 +0000 (-0800) Subject: Move checkedout? method to the Rentable superclass X-Git-Tag: turned-in~70 X-Git-Url: https://irasnyder.com/gitweb/?a=commitdiff_plain;ds=inline;h=6223af90077b9722e4d8add790a407f2cbcb6962;p=cs356-p2-videostore.git Move checkedout? method to the Rentable superclass This moves the checkedout? method to the Rentable superclass, so that it is available from both the Video and Game classes. Signed-off-by: Ira W. Snyder --- diff --git a/app/models/game.rb b/app/models/game.rb index 4c5d38c..0ca782b 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -2,7 +2,4 @@ class Game < Rentable validates_presence_of :game_genre validates_presence_of :platform - def checkedout? - return Coitem.find_by_id(self.id) ? true : false - end end diff --git a/app/models/rentable.rb b/app/models/rentable.rb index cccbb57..69ca422 100644 --- a/app/models/rentable.rb +++ b/app/models/rentable.rb @@ -3,4 +3,8 @@ class Rentable < ActiveRecord::Base validates_presence_of :title # don't validate newrelease, false is ok + + def checkedout? + return Coitem.find_by_rentable_id(self.id) ? true : false + end end