Module: CarrierWave::Uploader::Url

Defined in:
lib/carrierwave/uploader/url.rb

Instance Method Summary collapse

Instance Method Details

#to_json(*args) ⇒ Object

Returns

String

A JSON serializtion containing this uploader’s URL



27
28
29
# File 'lib/carrierwave/uploader/url.rb', line 27

def to_json(*args)
  { 'url' => url }.to_json(*args)
end

#urlObject Also known as: to_s

Returns

String

the location where this file is accessible via a url



12
13
14
15
16
17
18
# File 'lib/carrierwave/uploader/url.rb', line 12

def url
  if file.respond_to?(:url) and not file.url.blank?
    file.url
  elsif current_path
    File.expand_path(current_path).gsub(File.expand_path(root), '')
  end
end