# Grabbing names from main table foreign keys

**URL:** <https://www.ruby-forum.com/t/grabbing-names-from-main-table-foreign-keys/143455>\
**Category:** Ferret\
**Created:** [July 18, 2008, 8:08pm UTC](https://www.ruby-forum.com/t/grabbing-names-from-main-table-foreign-keys/143455 "2008-07-18T20:08:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pozza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8e8cbc/32.png) [@pozza](https://www.ruby-forum.com/u/pozza)\
**Post date:** [July 18, 2008, 8:08pm UTC](https://www.ruby-forum.com/t/grabbing-names-from-main-table-foreign-keys/143455/1 "2008-07-18T20:08:55Z")

</div>

I have a table being searched by ferret called expenses. In the expenses  
table I have a person\_id and project\_id field that links to the people  
and projects tables. How do I specify in acts\_as\_ferret to search for  
the linked people and projects associated within expenses?

I tried something like this:

acts\_as\_ferret :additional\_fields =\> [:person\_name]

def person\_name  
people.collect { |person| person.name }.join ’ ’  
end

But no luck.

Thanks!  
Paul
