Application_Form/custom_gallery/app/models/custom_album_unprocess.rb

18 lines
503 B
Ruby

class CustomAlbumUnprocess
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