+ 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}
+
+ scope :find_index, -> do
+ self.all
+ end
+
+ scope :find_private, -> (operators) do
+ where(artist_id: operators.artist.id)
+ end
+
+ scope :find_by_original_picture, -> (original_picture_id) do
+ find_index.where(original_picture_id: original_picture_id)
+ end
+
+ scope :find_by_license_group, -> (license_group_id) do
+ find_index.where(license_group_id: license_group_id)
+ end
+
+ scope :find_by_license, -> (license_id) do
+ find_index.where(license_id: license_id)
+ end
+
+ scope :find_by_artist, -> (artist_id) do
+ find_index.where(artist_id: artist_id)
+ end
+
+ scope :find_by_md5, -> (md5) do
+ find_index.where(md5: md5)
+ end
+
+ def self.pickup_item_name
+ Picture.item_name
+ end
+
+ def self.pickup_column_name
+ self.pickup_item_name + '_id'
+ end
+
+ def pickup_id
+ # get head picture
+ self.attributes[self.pickup_column_name]
+ end