jeudi 7 septembre 2017

Check if user has restaurant 48hours after sign up

I have some trouble to check if my user have created a restaurant 48 hours after signed_up ( the objective is to send an Email reminder).

I tried differents things and right now i'm with this in my

USER MODEL : User.rb

after_create :reminder



def reminder
    if Time.now.utc == self.created_at + 48.hours && self.restaurants.count == 0
    UserMailer.theactionofthemail(self).deliver_later
 end

I tried it like this because i saw that with sidekiq i didn't have to create job to deliver_later my UserMailers .. :)

Any Clues ? If it's not clear tell me !

Thank you in Advance

Aucun commentaire:

Enregistrer un commentaire