Where should I put code which calculates stats which will be sent via mail
So far as I can tell without seeing the rest of your of your application structure this seems fine. I am making the assumption that this is small app and that performance is not a real concern as of yet. One suggestion though, you could take those where statements and internalize them in their respective models as scopes. 

scope :task_count, -&gt; (date) { where(:adate =&gt; date).count }
scope :profile_count, -&gt; (date) { where(:ad_date =&gt; date).count }


This would at least neaten things up a bit and is a good habit to form, because it will insure consistency in behavior. Even though these are simple queries if you are reimplementing them (or any query) everywhere it creates the possibility to introduce errors; this is a benefit of code reuse.