Class: Spina::PhotoUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/spina/photo_uploader.rb

Instance Method Summary collapse

Instance Method Details

#extension_white_listObject



27
28
29
# File 'app/uploaders/spina/photo_uploader.rb', line 27

def extension_white_list
  %w(jpg jpeg gif png)
end

#store_dirObject



7
8
9
10
11
12
13
# File 'app/uploaders/spina/photo_uploader.rb', line 7

def store_dir
  if Engine.config.storage == :s3
    "#{mounted_as}/#{model.id}"
  else
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end
end

#too_large?(new_file) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/uploaders/spina/photo_uploader.rb', line 23

def too_large?(new_file)
  new_file.size > 120 * 1000
end