Andrew Kendall wrote:> i have a database setup with an id and a field called uniquename
>
> say for example my db looks like this:
>
> <table border="1" cellpadding="1"
cellspacing="1">
> <tr>
> <td>id</td>
> <td>uniquename</td>
> </tr>
> <tr>
> <td>1</td>
> <td>pizza</td>
> </tr>
> <tr>
> <td>2</td>
> <td>salad</td>
> </tr>
> </table>
>
> at the moment the routing works as follows:
>
> <b>domain.com/recipe/show/2</b>
>
> instead i''d like it to route from:
>
> <b>domain.com/recipe/show/salad</b>
>
> any ideas?
You can do this as-is. Just use the params[:id] differently. i.e.,
search for it in the database:
item = Items.find_by_uniquename(params[:id])
I''m a newbie answering a question, so take this with a grain of salt.
Jake
--
Posted via http://www.ruby-forum.com/.