You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class PersonPhotoUploader < CarrierWave::Uploader::Base
after :store, :delete_old_tmp_file
def store_dir
"people/#{model.id}"
end
def extension_white_list
%w(jpg jpeg gif png)
end
process resize_to_fit: [400, 400]
version :tiny do
process :resize_to_fill => [50, 50]
end
version :thumbnail do
process :resize_to_fill => [100, 100]
end
version :medium do
process :resize_to_fill => [200, 200]
end
def filename
"person_photo.#{file.extension}" if original_filename
end
# remember tmp file
def cache!(new_file)
super
@old_tmp_file = new_file
end
# delete tmp file
def delete_old_tmp_file(dummy)
@old_tmp_file.try :delete
end
end
When trying to recreate versions (using delayed job), I get an error (line 32: super).
If I remove the method cache!, it works fine but when redisplaying the form (if there's an error), I can't get the cached file.
I'm sure there must be a way to fix this but I don't know how. Any ideas?
Thanks!
Vincent
The text was updated successfully, but these errors were encountered:
Hey there,
Here's my uploader:
When trying to recreate versions (using delayed job), I get an error (line 32: super).
If I remove the method cache!, it works fine but when redisplaying the form (if there's an error), I can't get the cached file.
I'm sure there must be a way to fix this but I don't know how. Any ideas?
Thanks!
The text was updated successfully, but these errors were encountered: