Rolling with Ruby on Rails, Part 2
Subject:   "Showing recipes in a category" code
Date:   2005-03-10 02:21:34
From:   aeden
Response to: "Showing recipes in a category" code

Unfortunately the dynamic find method didn't work on my system. However this does:

@recipes = Recipe.find_all ["category_id = ?", @category]

I did have to make some changes to the HTML. First of all the category passed as the argument from the list page should be the category ID and not the name. Second of all you will need to remove the if statement in list.rhtml. I spent 10 minutes trying to figure out why it wasn't showing the filtered recipe list before I realized that this was the problem.

1 to 1 of 1
  1. Curt Hibbs photo "Showing recipes in a category" code
    2005-03-10 03:37:24  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

1 to 1 of 1