Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest May 25th, 2018 73 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. class Upload < ActiveRecord::Base
  2.   has_attachment  :content_type => ['application/pdf', :image],
  3.                   :processor => :MiniMagick,
  4.                   :storage => :file_system,
  5.                   :path_prefix => 'uploads',
  6.                   ##:max_size => 500.kilobytes,
  7.                   ##:resize_to => '384x256>',
  8.                   :thumbnails => {
  9.                       :large => '96x96>',
  10.                       :medium => '64x64>',
  11.                       :small => '48x48>'
  12.                   }
  13.                  
  14.   validates_as_attachment
  15.  
  16.  
  17.   ## there are no public filenames for these files
  18.   def public_filename
  19.     false
  20.   end
  21.    
  22.   def full_filename(thumbnail = nil)
  23.     file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s
  24.     File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail)))
  25.   end
  26.  
  27. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top