OSDN Git Service

comic test ok
[pettanr/pettanr.git] / app / models / comic.rb
index 44b1f3b..8dccc58 100644 (file)
@@ -28,6 +28,10 @@ class Comic < ActiveRecord::Base
     self.author_id == author.id
   end
   
+  def vis author
+    self.own?(author) or self.visible > 0
+  end
+  
   def disp_editable
     editable == 1 ? 'O' : 'X'
   end
@@ -88,4 +92,8 @@ class Comic < ActiveRecord::Base
     self.to_json( :include => {:author => {}, :panels => {:methods => :panel_element}})
   end
   
+  def self.visible_count
+    Comic.count 'visible > 0'
+  end
+  
 end