Created
July 10, 2014 14:32
-
-
Save francirp/87a005dfedd784b721e5 to your computer and use it in GitHub Desktop.
Manipulating an Array with find_all
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
all_pictures = Picture.all | |
pictures_with_source = all_pictures.find_all do |picture| | |
picture.source.present? | |
end | |
# pictures_with_source should now contain all of the pictures where the source is not empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment