class UserImage < ApplicationRecord
include UserImageUploader[:image]
end
# On rails console:
> u = UserImage.new
> u.image = StringIO.new(other_model.image)
> u.image.metadata
{
"filename" => nil,
"size" => 24426,
"mime_type" => "image/jpeg"
}
> u.image.metadata['filename'] = 'myfile.png'
"myfile.png"
> u.image.metadata['filename']
nil
u = UserImage.new
u.image = StringIO.new(other_model.image)
cached_file = u.image
cached_file.metadata["filename"] = "myfile.png"
u.image_data = cached_file.to_json
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/f4cf8769-ae0e-4bbe-a82a-69bef30ecc2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.