Method: CarrierWave::Uploader::Store#store!

Defined in:
lib/carrierwave/uploader/store.rb

#store!(new_file = nil) ⇒ Object

Stores the file by passing it to this Uploader’s storage engine.

If new_file is omitted, a previously cached file will be stored.

Parameters

new_file (File, IOString, Tempfile)

any kind of file object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/carrierwave/uploader/store.rb', line 79

def store!(new_file=nil)
  cache!(new_file) if new_file && !cached?
  if !cache_only && @file && @cache_id
    with_callbacks(:store, new_file) do
      new_file = storage.store!(@file)
      if delete_tmp_file_after_storage
        @file.delete unless move_to_store
        cache_storage.delete_dir!(cache_path(nil))
      end
      @file = new_file
      @identifier = storage.identifier
      @original_filename = @cache_id = @deduplication_index = nil
      @staged = false
    end
  end
end