-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodules.rb
More file actions
42 lines (30 loc) · 740 Bytes
/
modules.rb
File metadata and controls
42 lines (30 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'carrierwave'
class FileUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_white_list
%w(pdf)
end
end
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def default_url
'/images/' + [version_name, 'default.png'].compact.join('_')
end
version :thumb do
process resize_to_fill: [300, 200]
end
version :tiny do
process resize_to_fill: [64, 64]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end