assets.rb 526 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Checklist
  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. Rails.logger.debug [app_model, id, data[app_model]]
  11. return data if data[ app_model ][ id ]
  12. data[ app_model ][ id ] = attributes_with_association_ids
  13. items.map { |item| data = item.assets(data) }
  14. data
  15. end
  16. end
  17. end