Hey guys,
I was recently playing around with Rails and Ajax functions (all the Web 2.0 bits). Mainly, I was playing around with the text edit auto-complete functionality that comes along with rails. You can see this functionality in action in quite a few major websites (such as http://finance.yahoo.com or Google Suggest) where the text box starts to display auto-complete options as you're typing in the text box.

When playing with this functionality, I managed to hit a few snags. It is very easy to create this functionality in rails if you only need to query a single field from a single table with no limiting conditions. However, when you try to do something more than this, it isn't always that easy.

In my case, I was trying to limit the number of suggestions for the auto-complete based on the values of other fields on the web page. On top of that, the simple examples in my book(s) and certain websites only showed how to query a single column in a single table for the results whereas I wanted to show the options from two columns on different tables. The examples also showed no way of limiting those results with a WHERE clause (in my case, I needed to filter by non-deleted items).
As it turns out, there aren't too many articles dealing with these real-world issues (in fact, for my first issue, I couldn't find a single answer even after a lot of googling)

After a bit of googling, some HTTP header snooping, some javascript hacking and a bit of elbow grease, I managed to solve all these issues. For the benefit of others, I've put my solutions in this article on my website.

I would sure appreciate some feedback from you folks about the contents of that tutorial. Any useful comments will be gratefully acknowledged in my credits page.

Thanks in advance for your help.