Auto_complete on steroids

I am trying to get more out of auto_complete than it apparently was
designed to deliver.

My problems seem to be two fold.

1 - I use aggregations on
names… :first_name, :middle_initial, :last_name and then aggregate
them using a composed_of :wholename thing

auto_complete_for seems to be wired to only use table columns directly
and gags on the aggregate form.

2 - foreign table columns - auto_complete_for seems to be unusable for
obtaining matching values from a column in another table but I haven’t
fully explored this since I was trying to get the aggregation per above
and finally stayed within table and found that aggregations didn’t work
period and when I checked out the api, I sort of knew why.

So I ask…is there an auto_complete plugin/gem that I can’t seem to
find that is like auto_complete on steroids?

Thanks

Craig

Hi Craig,
I don’t know of any ‘auto_complete on steroids’ but you can do alot more
than the defaults if you write your own sql.
If you take a look at Amy Hoy’s post of auto-complete she shows how to
do
this in the ‘roll your own’ section.

http://www.slash7.com/articles/2005/08/13/ajaxariffic-autocomplete-with-scriptaculous

If you do that you should be able to use CONCAT in your sql statement to
concat a few columns together. After that you’d probably want to get rid
of the white space from your query because after the concat, you won’t
have any white space between firstname,middle and last. (ie.
EricAGoodwin
)
Check out the example below.

SELECT * FROM users WHERE CONCAT(firstname,middlename,lastname) =
#{params[:q].gsub(/\s/,‘’)};

You should be able to write your own sql for the foreign tables columns
as
well.

Cheers,
Eric G.

On Sun, 2006-02-26 at 05:10 +0000, Eric G. wrote:

of the white space from your query because after the concat, you won’t
have any white space between firstname,middle and last. (ie. EricAGoodwin
)
Check out the example below.

SELECT * FROM users WHERE CONCAT(firstname,middlename,lastname) =
#{params[:q].gsub(/\s/,’’)};

You should be able to write your own sql for the foreign tables columns as
well.


yep - that looks like what I want to do.

OK - makes for some excitement on an otherwise dull Saturday night.

:wink:

Thanks

Craig