PictureIO.original_picture_io.get self.filename, subdir
end
+ def self.export(dt = nil)
+ opt = {}
+ cond = if dt
+ ['artists.author_id is not null and original_pictures.updated_at >= ?', dt]
+ else
+ 'artists.author_id is not null'
+ end
+ opt.merge!({:conditions => cond})
+ opt.merge!({:include => {:resource_picture => {}, :artist => {}}, :order => 'original_pictures.id'})
+ OriginalPicture.find(:all, opt)
+ end
+
+ def list_as_json_with_resource_picture
+ self.to_json({:include => {:resource_picture => {:methods => :picture_data}}})
+ end
+
+ def self.list_as_json_text ary
+ '[' + ary.map {|i| i.list_as_json_with_resource_picture }.join(',') + ']'
+ end
+
def destroy_with_resource_picture
res = false
OriginalPicture.transaction do
res
end
- def self.export ar
- l = LicenseGroup.list
- op = OriginalPicture.list ar.id
- {:license_groups => l, :original_pictures => op}
- end
-
end