Since I got a melancholic and pensive in my last article I’ll reward you guys for sticking through it with a fun level 100 quick tip. (Something I hope to continue on the blog!) Everyone and their sister has a google suggest clone, right? And why not do it in Rails? I mean, it’s probably one of the easiest Ajax enabled controllers that you can do with
Ruby on Rails so let’s take a look. I’ll assume you have a project already with something to search. Since we did a little
mini-blog app recently we’ll use
the original code sample project from that app.
BTW- this is the original link, I’ll add the update at the bottom.
First off, a simple controller with one method: index
script/generate controller search index
Now, open the index view and let’s add in some code to look for articles based on what the user passes in. First is the view to make this happen…