I’m creating a basic cookbook app, and I allow users to choose whether
or not the recipe is vegetarian (entered into the database column
vegetarian as 1), vegan (entered into the database column vegetarian as
2), or neither (entered into the database column as 0).
I’d like to have a page that lists only the vegetarian recipes (rows in
the database “recipes” where the value of recipe.vegetarian is 1).
I’m a newbie, so I can get all recipes out of the database in the view
with:
<% @recipe.each do |recipe| %>
How do I get it to only list recipes where recipe.vegetarian == 1? I
just don’t get the exact syntax.
Thanks!