I am working on a RoR application and I am working on writing the blog component. I am planning to have a layout file that will display all of the tags from the database on each page within blog component. I know how to create and use a different layout file other than application.html.erb, but what I don’t know is how to read the tags list from the database for each action in the various controllers. I would not like to create the appropriate instance variable within each action. What is an appropriate way to approach this?
Share
Use a
before_filterin yourapplication_controllerto create the instance variable: