mardi 23 décembre 2014

Complex Model-related logic called via Rake: where to keep it?

One of the rake tasks in our RoR application is pretty complex - it interacts with external APIs and updates separate Rails model containing some social metrics. That task and it's functions are called exclusively from cron, but the task itself contains some model-related logic (like creating needed associations with other models).


So my question is, where should we put all the code that provides the logic? Keep it in the task? Move it to model's class methods? Which is better, fat model and skinny rake task, or the other way around?


Aucun commentaire:

Enregistrer un commentaire