Refactoring: Make asset fetch more robust for records referring to deleted records.
This commit is contained in:
parent
ce27170434
commit
5356c9f9f1
1 changed files with 3 additions and 1 deletions
|
@ -145,7 +145,9 @@ get assets of object list
|
|||
def assets_of_object_list(list, assets = {})
|
||||
list.each do |item|
|
||||
require_dependency item['object'].to_filename
|
||||
record = Kernel.const_get(item['object']).find(item['o_id'])
|
||||
record = Kernel.const_get(item['object']).lookup(id: item['o_id'])
|
||||
next if record.blank?
|
||||
|
||||
assets = record.assets(assets)
|
||||
if item['created_by_id'].present?
|
||||
user = User.find(item['created_by_id'])
|
||||
|
|
Loading…
Reference in a new issue