This is a method that used to be in the controller and I think it makes more sense to make it a method to the Contact model:
def colleagues
company = Company.find(self.company_id)
contacts = company.contacts.collect(&:full_name)
contacts.each do |contact|
colleagues = contacts.reject{ |c| c==contact }
end
return colleagues
end
Each Contact belongs to a Company. Each Company may have many other Contacts. The colleagues of a specific contact are the other members of the Company to which the specified contact belongs to.
I seem to be getting an error, a stack to deep error.