Skip to content

Instantly share code, notes, and snippets.

@matstc
Created October 21, 2014 13:40
Show Gist options
  • Save matstc/de6315cbb22027465152 to your computer and use it in GitHub Desktop.
Save matstc/de6315cbb22027465152 to your computer and use it in GitHub Desktop.
Example of a single layer of abstraction
def favorite post
favorite = post.favorites.create!(user: current_user)
post.user.notify_of favorite if post.user.likes_emails?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment