mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-03 10:24:30 +08:00
Fix forms items NA [SCI-11844]
This commit is contained in:
parent
19e6b0740e
commit
0610fb347b
1 changed files with 7 additions and 5 deletions
|
@ -21,6 +21,7 @@ class FormRepositoryRowsFieldValue < FormFieldValue
|
|||
before_save :attach_snapshot_files
|
||||
|
||||
def attach_snapshot_files
|
||||
if data.present?
|
||||
# find asset values and attach file blobs
|
||||
data.map { |r| r['repository_cells'] }.flatten.filter { |c| c['value_type'] == 'RepositoryAssetValue' }.each do |c|
|
||||
blob_id = c.dig('repository_asset_value', 'asset', 'file', 'blob', 'id')
|
||||
|
@ -30,6 +31,7 @@ class FormRepositoryRowsFieldValue < FormFieldValue
|
|||
snapshot_files.attach(ActiveStorage::Blob.find(blob_id))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def value=(repository_row_ids)
|
||||
# removes repository row snapshots if they are not present in the new id array,
|
||||
|
|
Loading…
Add table
Reference in a new issue