search_index.rb 662 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class Organization
  3. module SearchIndex
  4. extend ActiveSupport::Concern
  5. =begin
  6. lookup name of ref. objects
  7. organization = Organization.find(123)
  8. attributes = organization.search_index_attribute_lookup
  9. returns
  10. attributes # object with lookup data
  11. =end
  12. def search_index_attribute_lookup
  13. attributes = super
  14. # add org members for search index data
  15. attributes['members'] = []
  16. users = User.where(organization_id: id)
  17. users.each do |user|
  18. attributes['members'].push user.search_index_data
  19. end
  20. attributes
  21. end
  22. end
  23. end