Jeff Waltzer and John Maxwell Tried out Rails Ajax-driven auto completion fields. Documentation is, um, skimpy. Changes to make it work:
- Install Rails plugin for auto-completion using the command 'script/plugin install auto_complete'
- Add the auto-completion code to the begining of the controller classes which have fields that we want to auto-complete, like this (code goes at the top of the class declaration): 'auto_complete_for :a_table, :word' where 'a_table' is the table name, and 'word' is the column name
Change the form fields which will now have auto completion from text_field to text_field_with_auto_complete; our example would look like '<%= text_field_with_auto_complete :a_table, :word %>'
Next, we tripped over Rails' anti-cross-site-scripting measures. To disable this, add the line 'self.allow_forgery_protection = false'. This is strictly a hack; we really should've figured out why Rails was barfing and fixed it. Some other time.