OSDN Git Service

picture model broken
[pettanr/pettanr.git] / app / models / original_picture.rb
index 90679f4..c0032f1 100644 (file)
@@ -50,18 +50,20 @@ class OriginalPicture < ActiveRecord::Base
     {:include => [:resource_picture, :artist, :license]}
   end
   
-  def self.show cid, opt = {}
-    Comic.find(cid, :include => self.show_include_opt(opt))
+  def self.show cid, author, opt = {}
+    pic = OriginalPicture.find(cid, :include => self.show_include_opt(opt))
+    raise ActiveRecord::Forbidden unless pic.own?(author)
+    pic
   end
   
   def self.show_include_opt opt = {}
-    res = [:author]
+    res = [:license]
     res.push(opt[:include]) if opt[:include]
     res
   end
   
   def self.show_json_include_opt
-    {:include => :author}
+    {:include => :license}
   end
   
   def destroy_with_file