From 6223af90077b9722e4d8add790a407f2cbcb6962 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Wed, 21 Nov 2007 22:36:22 -0800 Subject: [PATCH] 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 --- app/models/game.rb | 3 --- app/models/rentable.rb | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) 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 -- 2.25.1