Parent

Included Modules

Class/Module Index [+]

Quicksearch

AttachmentUploader

Public Instance Methods

extention() click to toggle source

Override the filename of the uploaded files: Avoid using model.id or version_name here, see uploader/store.rb for details. def filename

"something.jpg" if original_filename

end

# File app/uploaders/attachment_uploader.rb, line 90
def extention
  File.extname(full_filename(file.file)).downcase
end
full_filename(for_file) click to toggle source
# File app/uploaders/attachment_uploader.rb, line 35
def full_filename(for_file)
  super.chomp(File.extname(super)) + '.jpg'
end
get_cover() click to toggle source
# File app/uploaders/attachment_uploader.rb, line 23
def get_cover 
  manipulate! do |frame, index|
    frame if  index.zero?    
  end
end
image?(for_file) click to toggle source
# File app/uploaders/attachment_uploader.rb, line 97
def image?(for_file)
  %(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase)
end
pdf?(for_file) click to toggle source
# File app/uploaders/attachment_uploader.rb, line 93
  def pdf?(for_file)
#    %w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase) 
    false
 end
root() click to toggle source

include CarrierWave::RMagick include CarrierWave::MiniMagick

# File app/uploaders/attachment_uploader.rb, line 10
def root
  Rails.root.join 'public/'
end
store_dir() click to toggle source

Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:

# File app/uploaders/attachment_uploader.rb, line 20
def store_dir
  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.