Module | Paperclip::Storage::Filesystem |
In: |
lib/paperclip/storage/filesystem.rb
|
The default place to store attachments is in the filesystem. Files on the local filesystem can be very easily served by Apache without requiring a hit to your app. They also can be processed more easily after they‘ve been saved, as they‘re just normal files. There is one Filesystem-specific option for has_attached_file.
:path => "/var/app/attachments/:class/:id/:style/:basename.:extension"
# File lib/paperclip/storage/filesystem.rb, line 22 22: def exists?(style_name = default_style) 23: if original_filename 24: File.exist?(path(style_name)) 25: else 26: false 27: end 28: end
Returns representation of the data of the file assigned to the given style, in the format most representative of the current storage.
# File lib/paperclip/storage/filesystem.rb, line 32 32: def to_file style_name = default_style 33: @queued_for_write[style_name] || (File.new(path(style_name), 'rb') if exists?(style_name)) 34: end