Rails: Calling a mailer method when Time.now is equal to time set in db

Hi,

I am doing a project on Ruby on Rails. This app has a table “reminder” with “e-mails”, “Subjects”, “Bodies” and “Scheduled times” columns (form with datetime_select is used to insert records).

When Time.now meets “Scheduled time” in database, app should send this particular record (Subject and Body) to the corresponding e-mail address. Can somebody help me with the method creation which suppose to compare Time.now with scheduled time in “reminder” table (there can be more than one record with that time in db) and passes required data to mailer, please? Would it be good to schedule with “whenever” to run that every minute? Or maybe you can share other methods which would trigger times comparison and e-mails sending. Time zones shouldn’t be considered now, it will just be used UTC.

I am quite new in Rails and I can’t find much relevant information on the web, so any information or suggestions are greatly appreciated.

Thanks!

Suggestion: http://edgeguides.rubyonrails.org/active_job_basics.html

HTH!