I am working on application for tracking different issues. Each issue belongs to some category.
I want to display category list on each page in the footer.
Right now I am doing it like this:
class ApplicationController < ActionController::Base ... before_filter :set_footer_categories def set_footer_categories @footer_categories = Category.all end end
And in footer section of application layout I have this code:
<%= render collection: @footer_categories, partial: 'footer_category' %>
But is this a correct way? Is it ok to initialize this instance variable for each controller action?
It doesn’t feel right to me, but I do not know better solution yet.
If you can provide me some best practice it would be great!
Many thanks in advance for your answers.