Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Created May 13, 2017 19:06
Show Gist options
  • Save kopylovvlad/3703a5587a5732ed9b54fafd34585068 to your computer and use it in GitHub Desktop.
Save kopylovvlad/3703a5587a5732ed9b54fafd34585068 to your computer and use it in GitHub Desktop.
subscribers.each do |row|
subscriber_row = SubscriberRow.new(row)
user = User.find_by_or_create_by_subscribe(subscriber_row.user_hash)
subscriptions = Subscription.find(subscriber_row.subsc_ids)
if subscriber_row.subscribe?
user.subscribe(subscriptions)
user.send_greeting_email(subscriptions)
end
if subscriber_row.unsubscribe?
user.unsubscribe(subscriptions)
user.send_unsubscribe_email(subscriptions)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment