We have a model named Influencer and a team mate came up with a method for retrieving all emails for a influencer. He then used it in a view. He put it in a helper (module):
def emails(influencer)
# do stuff with influencer to extract emails (spread in several fields)
end
I argued that such a method should go into the model, as it can be very useful anywhere in the code apart from the views (we have a very strong job-based backend).
My code inside Influencer model will go something like this:
def emails
# do stuff with influencer to extract emails (spread in several fields)
end
influencer.emails # Returns influencer emails.
The specific reason he gives is that in the model should only go code that touches the database. IMO anything that abstracts code to retrieve data from the model should go in the model. Here a question/answer that points out my point of view.
What do you think is the best place to put this method?