Skip to content
Janko Marohnić edited this page Nov 30, 2019 · 1 revision

Assigning a file copy

The following example copies the attachment of one record and assigns it to another:

source_attacher      = record1.file_attacher
destination_attacher = record2.file_attacher

destination_attacher.attach          source_attacher.file
destination_attacher.add_derivatives source_attacher.derivatives # if using derivatives

Assigning the same file

The following example assigns the attachment of one record to another without copying it:

source_attacher      = record1.file_attacher
destination_attacher = record2.file_attacher

destination_attacher.set             source_attacher.file
destination_attacher.set_derivatives source_attacher.derivatives # if using derivatives