Skip to content

Instantly share code, notes, and snippets.

@madsheep
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madsheep/51cda43e3320bdbf1f4e to your computer and use it in GitHub Desktop.
Save madsheep/51cda43e3320bdbf1f4e to your computer and use it in GitHub Desktop.
Example 1 - simple model.
class Membership
belongs_to :user
belongs_to :group
after_save :send_email_notification, if: ->(m) { m.accepted_changed? && m.accepted? }
def send_email_nofication
NotificationMailer.accepted(self, user).deliver!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment