Skip to content

Instantly share code, notes, and snippets.

@mdesanti
Last active October 14, 2015 11:50
Show Gist options
  • Save mdesanti/bc634f75d385819fb6b0 to your computer and use it in GitHub Desktop.
Save mdesanti/bc634f75d385819fb6b0 to your computer and use it in GitHub Desktop.
class PhotoUploader < CarrierWave::Uploader::Base
# Choose what kind of storage to use for this uploader:
storage :fog
# 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
if version_name == nil
"uploads/originals/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
else
"uploads/resized/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end
version :resized, if: :never
def never(object)
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment