Automated email notification summary
Hi, I like to have my application to send automated emails summary to users.
Users have multiple profiles that they can make and like to notify the users by email if there is more than 5 new profiles in the app. My app is here http://www.snappaajat.fi/ so people can add them snapchat profiles and other users can view and search.
Is there some gem that do this or can Chris make some video tutorial. ;)
If you want to send these on a regular basis, cron jobs are perfect for that. You can just set it up to run weekly and notify users from a rake task. Easy to test and maintain. I did an episode on that a while back: https://gorails.com/episodes/cron-jobs-with-whenever-gem?autoplay=1
Otherwise if you want it to happen on a trigger in-app like a notification every time a new profile is created, you can just put the logic in your controller to check who should receive the notification and then send that out. This sort of thing is a good case for using a service object (just a regular ruby class that contains the logic for it).