Created
March 2, 2010 17:54
-
-
Save etaque/319718 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AvatarUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
storage :file | |
def store_dir | |
"assets/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | |
end | |
version :thumb do | |
process :resize_to_fill => [60, 60] | |
end | |
version :medium do | |
process :resize_to_fit => [200, 120] | |
end | |
def extension_white_list | |
%w(jpg jpeg gif png) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile < ActiveRecord::Base | |
mount_uploader :avatar, AvatarUploader | |
# Usual stuff... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment