module RademadeAdmin::Uploader::Photo

Public Instance Methods

delete_other_images(image_path) click to toggle source
# File lib/rademade_admin/uploader/photo.rb, line 10
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
method_missing(name, *arguments) click to toggle source
Calls superclass method
# File lib/rademade_admin/uploader/photo.rb, line 5
def method_missing(name, *arguments)
  raise NotImplemented.new 'Implement "resize" error' if name == 'resize'
  super
end

Protected Instance Methods

full_image_path(image_path) click to toggle source

todo problem with other storages

# File lib/rademade_admin/uploader/photo.rb, line 30
def full_image_path(image_path)
  File.join(Rails.root, 'public', image_path)
end