Created
October 5, 2018 11:46
-
-
Save adiwids/c63845f9c650903a0c27c7368b8de9cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Find user that has registered device (reg token registered) on server | |
user = User.find_by(email: '<email>') | |
# Find last notification object received by that user | |
notif = PushNotification.where(recipient_id: u.id).last | |
# Assign notificatable object (might be object of Post, Comment, etc) from 'notif' | |
obj = notif.notificatable | |
# Destroy last notification log, assigned as 'notif' since server won't send any duplicate notification object | |
notif.destroy | |
# Re-send notification | |
PushNotification.broadcast_notifications_for(obj, [user]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment