Skip to content

Instantly share code, notes, and snippets.

@matstc
Created October 21, 2014 13:39
Show Gist options
  • Save matstc/9d3f2cffae739c59140a to your computer and use it in GitHub Desktop.
Save matstc/9d3f2cffae739c59140a to your computer and use it in GitHub Desktop.
Example of varying levels of abstraction
def favorite post
post.favorites.create!(user: current_user)
if post.user.email_settings.email_favorites?
UserMailer.favorite_email('Your post was favorited!',
"Good job! Your post was favorited.
#{link_to post_path(post), 'Have a look for yourself'}. \
Your friendly social networking team.").deliver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment