OSDN Git Service

fix license picture
[pettanr/pettanr.git] / app / models / resource_picture.rb
index 4c02cc1..773c4c3 100644 (file)
@@ -16,16 +16,19 @@ class ResourcePicture < Peta::Content
   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_module_name, :presence => true, :length => {:maximum => 50}
   validates :picture_id, :presence => true, :numericality => true, :existence => {:both => false}
+  validates :license_settings, :boost => {:boost_name => :license}
+  validates :license_group_settings, :boost => {:boost_name => :license_group}
+  validates :credit_picture_settings, :boost => {:boost_name => :credit_picture}
   
   def supply_default
   end
   
   def overwrite op
     attr = {:width => op.width, :height => op.height, :ext => op.ext, :filesize => op.filesize, 
-      :original_picture_id => op.id, :artist_id => op.artist_id, :md5 => op.md5
+      :original_picture_id => op.id, :artist_id => op.artist_id, :md5 => op.md5,
+      :created_at => Time.now, :updated_at => Time.now
     }
     self.attributes = attr
   end