Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com> Co-authored-by: Manoj <manojmj92@gmail.com> Co-authored-by: Nithin <webofnithin@gmail.com>
This commit is contained in:
21
app/uploaders/attachment_uploader.rb
Normal file
21
app/uploaders/attachment_uploader.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class AttachmentUploader < CarrierWave::Uploader::Base
|
||||
include CarrierWave::MiniMagick
|
||||
|
||||
def store_dir
|
||||
if Rails.env.test?
|
||||
"#{Rails.root}/spec/support/uploads/avatar/#{model.class.to_s.underscore}/#{model.id}"
|
||||
else
|
||||
"uploads/attachments/#{model.class.to_s.underscore}/#{model.id}"
|
||||
end
|
||||
end
|
||||
|
||||
version :thumb, :if => :image? do
|
||||
process resize_to_fill: [280,280]
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def image?(new_file)
|
||||
model.image?
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user