OSDN Git Service

add libs.js & finder_path_shadow.gif
[pettanr/pettanr.git] / app / models / picture.rb
index b9d7da1..3b1fc56 100644 (file)
@@ -44,6 +44,7 @@ class Picture < ActiveRecord::Base
   end
   
   def showable? au = nil
+    return false unless self.original_picture
     return true if self.own?(au)
     self.enable? and self.head?
   end
@@ -161,6 +162,12 @@ class Picture < ActiveRecord::Base
     PictureIO.picture_io.get self.filename, subdir
   end
   
+  def unpublish
+    imager = PettanImager.load(File.open(Rails.root + 'app/assets/images/error.png', 'rb').read)
+    return false unless imager
+    self.store imager
+  end
+  
   def credit_template
     "#{self.classname.tableize}/attributes/credit"
   end