Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Upload < ActiveRecord::Base
- has_attachment :content_type => ['application/pdf', :image],
- :processor => :MiniMagick,
- :storage => :file_system,
- :path_prefix => 'uploads',
- ##:max_size => 500.kilobytes,
- ##:resize_to => '384x256>',
- :thumbnails => {
- :large => '96x96>',
- :medium => '64x64>',
- :small => '48x48>'
- }
- validates_as_attachment
- ## there are no public filenames for these files
- def public_filename
- false
- end
- def full_filename(thumbnail = nil)
- file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s
- File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail)))
- end
- end
Add Comment
Please, Sign In to add comment