OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / comic.rb
index fbb04e2..19149d5 100644 (file)
@@ -7,16 +7,31 @@ class Comic < Pettanr::Content
   validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
   validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   
-  @@valid_encode_columns += ['title', 'description']
   @@visible_count_options = {:conditions => 'visible > 0'}
   
+  def self.singular
+    'Comic'
+  end
+  
+  def self.plural
+    'Comics'
+  end
+  
+  def self.owner_type
+    :author
+  end
+  
+  def self.valid_encode_columns
+    super + ['title', 'description']
+  end
+  
   def supply_default
     self.visible = 0 if self.visible.blank?
   end
   
-  def overwrite au
-    return false unless au
-    self.author_id = au.id
+  def overwrite operators
+    return false unless operators.author
+    self.author_id = operators.author.id
   end
   
   def visible? operators