Suppose there is a call to get Analytics data from a third party or through our cache data on a server, for the "most popular items", and we show these items' names on all of our pages, should we put this code in Model, Controller, or View (Helper) component?
Maybe it is not strictly Model, because it is not directly in our data store.
Maybe it is Controller... should it be in the "general controller", such as in app/controller/application.rb
to be sharable in all views? What if it is obtained in the controller code, but 1 month later, another person follow a new spec and remove the display of it on a view, then the code probably stay at the controller and nobody will remove it.
If it is in the helper... then what if in other part of the code, the controller need to get that data and store it in @popular
? Also, aren't helpers suppose to help render data by putting repeated task in methods? So helpers shouldn't do so much data fetching logic.
Where is the code most properly placed?