Module: Paperclip::Storage::Elvfs
- Defined in:
- lib/paperclip/storage/elvfs.rb
Class Method Summary collapse
Instance Method Summary collapse
- #exists?(style_name = default_style) ⇒ Boolean
-
#flush_deletes ⇒ Object
:nodoc:.
-
#flush_writes ⇒ Object
:nodoc:.
Class Method Details
.extended(base) ⇒ Object
6 7 |
# File 'lib/paperclip/storage/elvfs.rb', line 6 def self.extended base end |
Instance Method Details
#exists?(style_name = default_style) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/paperclip/storage/elvfs.rb', line 9 def exists?(style_name = default_style) if original_filename !!file_json(path(style_name)) else false end end |
#flush_deletes ⇒ Object
:nodoc:
28 29 30 31 32 33 34 35 |
# File 'lib/paperclip/storage/elvfs.rb', line 28 def flush_deletes #:nodoc: @queued_for_delete.each do |path| log("deleting #{path}") delete_entry(File.dirname(path)) instance.update_column "#{name}_url", nil if instance.persisted? end @queued_for_delete = [] end |
#flush_writes ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/paperclip/storage/elvfs.rb', line 17 def flush_writes #:nodoc: @queued_for_write.each do |style_name, file| delete_entry(path(style_name)) if exists?(style_name) upload_file(path(style_name), file) end after_flush_writes # allows attachment to clean up temp files @queued_for_write = {} end |