-
-
Save PerezIgnacio/01a45bb385afb84b1a8e792360a30696 to your computer and use it in GitHub Desktop.
Example using UsersQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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