trabajo-afectivo/app/models/organization/search_index.rb

24 lines
588 B
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
2015-04-27 21:44:41 +00:00
class Organization
module SearchIndex
extend ActiveSupport::Concern
def search_index_attribute_lookup(include_references: true)
2016-07-06 06:13:44 +00:00
attributes = super
2015-04-27 21:44:41 +00:00
if include_references
# add org members for search index data
attributes['members'] = []
users = User.where(organization_id: id)
users.each do |user|
attributes['members'].push user.search_index_attribute_lookup(include_references: false)
end
end
2015-04-27 21:44:41 +00:00
2016-07-06 06:13:44 +00:00
attributes
2015-04-27 21:44:41 +00:00
end
end
2014-02-03 19:23:00 +00:00
end