Sha256: 465d7c59d12c5965edd889335176ed9973d739e1aaba2233191b114e81d83526
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
module CarrierWave def self.tmp_path @tmp_path ||= Card.paths["tmp"].existent.first end class FileCardUploader # path-related methods for uploader module Path def local_url opts={} "%s/%s/%s" % [local_url_base(opts), file_dir, full_filename(url_filename(opts))] end def local_url_base opts={} web_path = Card.config.files_web_path opts.delete(:absolute) ? card_url(web_path) : card_path(web_path) end def public_path File.join Cardio.paths["public"].existent.first, url end def cache_dir @model.files_base_dir + "/cache" end # Carrierwave calls store_path without argument when it stores the file # and with the identifier from the db when it retrieves the file. # In our case the first part of our identifier is not part of the path # but we can construct the filename from db data. So we don't need the # identifier. def store_path for_file=nil if for_file retrieve_path else File.join([store_dir, full_filename(filename)].compact) end end def retrieve_path File.join([retrieve_dir, full_filename(filename)].compact) end def tmp_path Dir.mkdir model.tmp_upload_dir unless Dir.exist? model.tmp_upload_dir File.join model.tmp_upload_dir, filename end # paperclip compatibility used in type/file.rb#core (base format) def path version=nil version ? versions[version].path : super() end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
card-mod-carrierwave-0.11.4 | lib/carrier_wave/file_card_uploader/path.rb |