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
Base64.encode64(self.restore 'full')
end
+ def new_template
+ "#{self.license_group_module_name.tableize}/attributes/new"
+ end
+
def credit_template
"#{self.license_group_module_name.tableize}/attributes/credit"
end
"#{self.license_group_module_name.tableize}/attributes/full_credit"
end
+ def self.remake_all
+ ResourcePicture.find_each do |resource_picture|
+ resource_picture.boosts 'post'
+ full = resource_picture.restore 'full'
+ imager = PettanImager.load full
+ resource_picture.store_picture_with_gif(imager)
+ end
+ end
+
end