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

33 lines
625 B
Ruby
Raw Normal View History

2014-02-03 19:23:00 +00:00
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
2015-04-27 21:44:41 +00:00
class Organization
module SearchIndex
=begin
lookup name of ref. objects
2016-03-08 06:32:58 +00:00
organization = Organization.find(123)
2016-07-06 06:13:44 +00:00
attributes = organization.search_index_attribute_lookup
returns
attributes # object with lookup data
=end
2016-07-06 06:13:44 +00:00
def search_index_attribute_lookup
attributes = super
2015-04-27 21:44:41 +00:00
2016-07-06 06:13:44 +00:00
# add org members for search index data
attributes['members'] = []
2016-03-08 06:32:58 +00:00
users = User.where(organization_id: id)
2015-04-27 21:44:41 +00:00
users.each { |user|
2016-07-06 06:13:44 +00:00
attributes['members'].push user.search_index_data
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