Module: Mokio::Uploader::Asset
- Included in:
- DataFileUploader, MainPicUploader, ThumbUploader
- Defined in:
- lib/mokio/uploader/asset.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
-
#store_dir ⇒ Object
Override the directory where uploaded files will be stored.
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mokio/uploader/asset.rb', line 4 def self.included(base) # # Include RMagick or MiniMagick support: # base.send :include, CarrierWave::RMagick base.send :include, CarrierWave::MiniMagick # # What kind of storage to use for this uploader: # base.storage :file # # Create different versions of your uploaded files: # base.version :normal do process :resize_to_limit => [Mokio.default_width, Mokio.default_height] end base.version :thumb do process :resize_to_limit => [Mokio.photo_thumb_width, Mokio.photo_thumb_height] end base.version :medium do process :resize_to_limit => [Mokio.photo_medium_width, Mokio.photo_medium_height] end base.version :big do process :resize_to_fill => [Mokio.photo_big_width, Mokio.photo_big_height] end # # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: # def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end |
Instance Method Details
#store_dir ⇒ Object
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
39 40 41 |
# File 'lib/mokio/uploader/asset.rb', line 39 def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end |