Example using UsersQuery
task send_emails_notifications: :environment do | |
def send_email_to_users_without_recent_visits | |
users_without_recent_views = UsersQuery.new.without_recent_views | |
UsersQuery.new(users_without_recent_views).subscribed.find_each do |user| | |
SendNewProductsRecommendationsJob.perform_later(user) | |
end | |
end | |
def send_similar_purchases_emails_to_users | |
UsersQuery.new.for_notifications_of_similar_purchases.find_each do |user| | |
SendSimilarPurchasesRecomendationsJob.perform_later(user) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment