Module: HasAttachedFiles

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/has_attached_files.rb

Instance Method Summary collapse

Instance Method Details

#recalculate_all_attached_filesObject



8
9
10
11
12
13
# File 'app/models/concerns/has_attached_files.rb', line 8

def recalculate_all_attached_files
  af = all_attached_files.pluck(:attachment_file_size)
  self.all_attached_files_count = af.count
  self.all_attached_files_size  = af.sum
  save
end