assets.rb 469 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class ChecklistTemplate
  3. module Assets
  4. extend ActiveSupport::Concern
  5. def assets(data)
  6. app_model = self.class.to_app_model
  7. if !data[ app_model ]
  8. data[ app_model ] = {}
  9. end
  10. return data if data[ app_model ][ id ]
  11. data[ app_model ][ id ] = attributes_with_association_ids
  12. items.map { |item| item.assets(data) }
  13. data
  14. end
  15. end
  16. end