Module: CarrierWave::Compatibility::Paperclip
- Defined in:
- lib/carrierwave/compatibility/paperclip.rb
Overview
Mix this module into an Uploader to make it mimic Paperclip’s storage paths This will make your Uploader use the same default storage path as paperclip does. If you need to override it, you can override the paperclip_path
method and provide a Paperclip style path:
class MyUploader < CarrierWave::Uploader::Base
include CarrierWave::Compatibility::Paperclip
def paperclip_path
":rails_root/public/uploads/:id/:attachment/:style_:basename.:extension"
end
end
Instance Method Summary collapse
- #paperclip_default_style ⇒ Object
- #paperclip_path ⇒ Object
- #paperclip_style ⇒ Object
- #store_dir ⇒ Object
- #store_path(for_file = filename) ⇒ Object
Instance Method Details
#paperclip_default_style ⇒ Object
56 57 58 |
# File 'lib/carrierwave/compatibility/paperclip.rb', line 56 def paperclip_default_style :original end |
#paperclip_path ⇒ Object
60 61 |
# File 'lib/carrierwave/compatibility/paperclip.rb', line 60 def paperclip_path end |
#paperclip_style ⇒ Object
63 64 65 |
# File 'lib/carrierwave/compatibility/paperclip.rb', line 63 def paperclip_style version_name || paperclip_default_style end |
#store_dir ⇒ Object
52 53 54 |
# File 'lib/carrierwave/compatibility/paperclip.rb', line 52 def store_dir ":rails_root/public/system/:attachment/:id" end |
#store_path(for_file = filename) ⇒ Object
46 47 48 49 50 |
# File 'lib/carrierwave/compatibility/paperclip.rb', line 46 def store_path(for_file=filename) path = paperclip_path path ||= File.join(*[store_dir, paperclip_style.to_s, for_file].compact) interpolate_paperclip_path(path, for_file) end |