Created
December 15, 2009 21:18
-
-
Save mperham/257316 to your computer and use it in GitHub Desktop.
This file contains 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
def exists?(attribs) | |
CustomImage.find_by_account_id_and_hash(attribs['account_id'], attribs['id']) | |
end | |
# Cleaner way of doing the exists? and return/if without making the query twice? | |
# (the query can return nil so memoizing won't work) | |
def some_method(attribs) | |
img = exists?(attribs) | |
return img if img | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment