Hey, answered my own question. I copied the relevant bits
of
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/acti
on_controller/macros/auto_complete.rb
into environment.rb. Cool beans.
If anyone wants magic auto completion for indexed fields (a
la render
:partial) then let me know.
On 1/30/06, Ian Harding <harding.ian gmail.com> wrote:
> I have a crude hack to allow auto_complete to work with
indexed text
> fields. I needed it for a timecard entry form with an
arbtirary
> number of records which can be added/changed/delete
willy-nilly by
> users. One of the fields is a perfect candidate for
autocomplete
> since it references a database object with a large
number of choices
> and long descriptions. Using a select list is
extremely ugly in this
> case.
>
> I copied the code for text_field_with_auto_complete out
of
>
>
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/acti
on_view/helpers/java_script_macros_helper.rb
>
> and hacked it, putting the result in
>
> app/helpers/application_helper.rb
>
> as text_field_with_index_auto_complete. All it does
differently is
> not output the index in the name of the method to be
called.
>
> I copied the code for auto_complete_for out of
>
>
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/acti
on_controller/macros/auto_complete.rb
>
> and pasted it right back in as
auto_complete_with_index_for. It just
> ignores the index in the parameter. Everything else is
the same.
>
> I will probably submit a bug report and a patch
eventually, but in the
> meantime, I would like to know if I can put the new
> auto_complete_with_index_for somewhere local to my
application, or
> does it have to live in the rails source?
>
> Thanks!
>
> - Ian
>
--
"Her faults were those of her race and sex; her virtues
were her own.
Farewell, and if for ever - "
-- "Travels with a Donkey in the Cevennes" by
Robert Louis Stevenson
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|