Module: CarrierWave::Uploader::Url
- Included in:
- Base
- Defined in:
- lib/carrierwave/uploader/url.rb
Instance Method Summary collapse
-
#as_json(options = nil) ⇒ Object
Returns.
-
#url ⇒ Object
(also: #to_s)
Returns.
Instance Method Details
#as_json(options = nil) ⇒ Object
Returns
- String
-
A JSON serialization containing this uploader’s URL(s)
27 28 29 30 |
# File 'lib/carrierwave/uploader/url.rb', line 27 def as_json( = nil) h = { :url => url } h.merge Hash[versions.map { |name, version| [name, { :url => version.url }] }] end |
#url ⇒ Object 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.(current_path).gsub(File.(root), '') end end |