Hello everybody,
new to Ruby on Rails…
i’m following the tutorial at
but i’m having some issues…
now what i want to know is how-to display in a list, the value of a
field that is pointed by the fk…
example:
table categories:
id, name
table recipes:
id, category_id, title, description, …
where recipes.category_id is a fk for categories.id
i’ve the list view for the recipes where i want to display something
like:
Recipe Title Category
Smoked salmon on rocket leaves Starters
now how can do that?
in my views list.rhtml i’ve something like this:
<% for recipe in @recipes %>
what am i supposed to put in XXXXXXXXXX ? to see the category name
instead
of the category_id? (infact i have recipe.category_id
thanks for your help.