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