Send email asynchroniously using Sidekiq.
Create your mailer us usual:
scope :created_this_hour , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_hour}' AND '#{DateTime.now.end_of_hour}'") } | |
scope :created_this_day , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}'") } | |
scope :created_this_week , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_week}' AND '#{DateTime.now.end_of_week}'") } | |
scope :created_this_month , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_month}' AND '#{DateTime.now.end_of_month}'") } | |
scope :created_this_quarter , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_quarter}' AND '#{DateTime.now.end_of_quarter}'") } | |
scope :created_this_year , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_year}' AND '#{DateTime.now.end_of_year}'") } |