Reputation: 143
I plan to send my users a reminder email once a day.
I will user Heroku scheduler.
As I understand it:
I create a RAKE task in lib/tasks/scheduler.rake
Then do the config on Heroku to run that
In the RAKE task I need to call something like User.send_reminders, in send_reminders I pass a request to the mailer to send an email to each user.
My question is should send_reminders be in the the users model or the users controller?
Probably very basic but I can't quite work it out.
Thanks in advance.
Upvotes: 0
Views: 64
Reputation: 3326
Always need to write model related actions in the model itself. Controller should be kept percise for request related decision making.
So keep your send_reminders in model and call it from rake task.
Upvotes: 1