gallery/app/models/album_unprocess.rb

18 lines
497 B
Ruby

class AlbumUnprocess
include Mongoid::Document
field :image_id
field :save_var, type: String
field :upload_success, type: Boolean
def save_var
temp = YAML.load(self[:save_var])
temp[:tempfile] = File.open(temp[:tempfile])
ActionDispatch::Http::UploadedFile.new(temp)
end
def save_var=(value)
temp = {:filename => value.original_filename,
:type => value.content_type,
:head => value.headers,
:tempfile => value.tempfile.path}
self[:save_var] = temp.to_yaml
end
end