Move checkedout? method to the Rentable superclass
authorIra W. Snyder <devel@irasnyder.com>
Thu, 22 Nov 2007 06:36:22 +0000 (22:36 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Thu, 22 Nov 2007 06:36:22 +0000 (22:36 -0800)
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 <devel@irasnyder.com>
app/models/game.rb
app/models/rentable.rb

index 4c5d38c..0ca782b 100644 (file)
@@ -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
index cccbb57..69ca422 100644 (file)
@@ -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