If controller doesn't exist: search database for its name

I'll use my recipe example again. It would be nice if I could have my routes (I think) set up so that if somebody enters a a controller that doesn't exist a database search runs and looks for the controller name as one of the categories (for example the user enters http://www.com/italian). This is an existing category in the database so it would likely then redirect to www.com/categories/italian (and from there the categories controller would handle things).

Is this possible without violating any "rules"?

You would probably be able to do something by catching 404 errors in your application controller and then punting them off to a method that tries to guess what the user meant. Google for "Rails 404" for a few methods to try.

Michael Pavling wrote:

You can override method_missing. We used that approach at my last gig to grab userr-created content from a SharePoint site.

HTH, Bill