OSDN Git Service

fic picture publishing
[pettanr/pettanr.git] / app / models / resource_picture.rb
index 2ec0685..c6975ef 100644 (file)
@@ -3,6 +3,7 @@ class ResourcePicture < Peta::Content
   load_manifest
   belongs_to :artist
   belongs_to :license
+  belongs_to :system_picture
   belongs_to :picture
   belongs_to :original_picture
   
@@ -13,6 +14,7 @@ class ResourcePicture < Peta::Content
   validates :md5, :presence => true, :length => {:minimum => 32, :maximum => 32}
   validates :artist_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :license_id, :presence => true, :numericality => true, :existence => {:both => false}
+  validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :original_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :artist_name, :presence => true
   validates :license_group_classname, :presence => true, :length => {:maximum => 50}
@@ -68,6 +70,10 @@ class ResourcePicture < Peta::Content
     {:src => self.url('full'), :width => self.width, :height => self.height}
   end
   
+  def alt_name
+    self.license.license_group.caption.to_s + '[' + self.license.caption.to_s + ']'
+  end
+  
   def symbol_option
     self.tmb_opt_img_tag
   end