Method: Atech::ObjectStore::File#append
- Defined in:
- lib/atech/object_store/file.rb
#append(data) ⇒ Object
Appends data to the end of the current blob and updates the size and update time as appropriate.
136 137 138 139 140 |
# File 'lib/atech/object_store/file.rb', line 136 def append(data) raise CannotEditFrozenFile, "This file has been frozen and cannot be appended to" if frozen? File.execute_query("UPDATE files SET `blob` = CONCAT(`blob`, #{self.class.escape_and_quote(data)}), `size` = `size` + #{data.bytesize}, `updated_at` = '#{self.class.time_now}' WHERE id = #{@attributes['id']}") reload(true) end |