Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nburkley/1c8749080eafe1f2083aee3a30e464f7 to your computer and use it in GitHub Desktop.
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
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