Method: FileAttachment#update_filepath

Defined in:
app/models/file_attachment.rb

#update_filepathObject

update fs & db filepaths with updated values (eg after dev changes)



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'app/models/file_attachment.rb', line 119

def update_filepath
  old_path = full_path.dup
  build_filepath
  FileUtils.mv(old_path, full_path)
  unless file_saved?
    msg = "Error updating filepath for #{name}"
    logger.error(msg)
    errors.add(:base, msg)
    false
  else
    self.save
  end
end