Module: RademadeAdmin::Uploader::Photo

Included in:
CropPhoto
Defined in:
lib/rademade_admin/uploader/photo.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments) ⇒ Object



6
7
8
9
# File 'lib/rademade_admin/uploader/photo.rb', line 6

def method_missing(name, *arguments)
  raise NotImplemented.new 'Implement "resize" error' if name == 'resize'
  super
end

Instance Method Details

#delete_other_images(image_path) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rademade_admin/uploader/photo.rb', line 11

def delete_other_images(image_path)
  filename = File.basename(image_path)

  store_path = full_image_path(store_dir)

  return unless File.exist? store_path

  Dir.foreach(store_path) do |item|
    next if item == '.' or item == '..'
    if File.basename(item) != filename
      FileUtils.rm_r(File.join(store_path, item))
    end
  end
end