I’d like to have the main menu of my web application dynamically
generated from categories stored in a database.
I created a partial for this menu:
<% @categories.each do |category| %>
- <%= category.name %> <% end %>
And I call this partial in the main layout:
<%= render ‘category/list’ %>
Unfortunately, the @categories variable is Nil because the category/list
controller is not called with this method.
How can I simply achieve this ? Thank you,