Let’s say I have a dropdown that gets its value from a DB table. For the sake of argument, let’s keep it simple and use colors. I need to display the dropdown for a bunch of views from different controllers. I read a couple of blog posts where people use “helpers” while others initializes the controller’s method. If it’s a “generic” query such as this, where would one put code this method so that other controllers/views can access it?
Share
Put it in a model and auto load it if you need it that often. If there is a model that it fits into already, put it there. Otherwise, there is nothing wrong with creating a new model to meet your needs. Just try to keep things organized in a logical manner that meets your needs and makes it easy to track down the methods later.