Created
May 9, 2019 11:07
-
-
Save nburkley/1c8749080eafe1f2083aee3a30e464f7 to your computer and use it in GitHub Desktop.
Getting Started Snipped for https://niallburkley.com/blog/ruby-publish-subscribe/ blog post
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
class Post < ActiveRecord::Base | |
after_commit :notify_editors, on: :create | |
after_commit :generate_feed_item, on: :create | |
private | |
def notify_editors | |
EditorMailer.send_notification(self).deliver_later | |
end | |
def generate_feed_item | |
FeedItem.create(self) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment