categories
i've added categories. only one category per post, though. not sure about how to go about doing more than one. i also need to figure out how to link the category names in the menu to only show the relevant posts when clicked. i also figured out how to add the category in the post info under each post that each one is in. it came out like this (i'm sure there's an easier way):
<% @categories.each do |category| %>
<%= category.name if category.id == post.category_id %>
<% end %>
i created a categories table in the database and added a category_id field to the posts table. that's how the categories are linked to the posts.
0 Comments:
Post a Comment
<< Home