# Help with auto\_complete modifiction

**URL:** <https://www.ruby-forum.com/t/help-with-auto-complete-modifiction/131076>\
**Category:** Rails\
**Created:** [March 5, 2008, 8:35pm UTC](https://www.ruby-forum.com/t/help-with-auto-complete-modifiction/131076 "2008-03-05T20:35:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [March 5, 2008, 8:35pm UTC](https://www.ruby-forum.com/t/help-with-auto-complete-modifiction/131076/1 "2008-03-05T20:35:37Z")

</div>

Hi -

I’m trying to modify auto\_complete\_for to allow a foreign table to be  
the source of the lookup strings. It’s currently defined as:

def auto\_complete\_for(object, method, options = {})

which tells me I can simply add a “foreign” argument at the end of my  
call and it will be auto-added to the options array (is this right?).

So, now I change:

@items = object.to\_s.camelize.constantize.find(:all, find\_options)

to

options[:foreign] ? @items =  
options[:foreign].to\_s.camelize.constantize.find(:all, find\_options) :  
@items = object.to\_s.camelize.constantize.find(:all, find\_options)

And in my controller, I call:

auto\_complete\_for :story, :tag\_holder, :foreign =\> ‘tag’

But i get this error in the log:

ArgumentError (Unknown key(s): foreign):

Can someone explain options hash and what’s wrong here?

Thanks,  
Dino
